关于Apache VirtualHost Goagent

最近goagent 连GAE老是出问题,想着用自己的VPS 架个代理吧,goagent自带的php的

本很容易,但是遇到一个问题弄了很久:

我的VPS上有两个域名,我之前是开了name virtual host:

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/html
    ServerName www.bbaltcoin.com
    ServerAlias bbaltcoincom *.bbaltcoin.com
    ErrorLog /var/log/httpd/bbaltcoin.com_log
    CustomLog /var/log/httpd/bbaltcoin.com_log common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/site2
    ServerName www.bbvoid.com
    ServerAlias bbvoid.com *.bbvoid.com
    ErrorLog /var/log/httpd/bbvoid.com_log
    CustomLog /var/log/httpd/bbvoid.com_log common
</VirtualHost>

然后我就理所当然得加了个项:

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/goagent
    ServerName goagent.bbvoid.com
    ErrorLog /var/log/httpd/goagent.bbvoid.com_log
    CustomLog /var/log/httpd/goagent.bbvoid.com_log common
</VirtualHost>

可是一直跳转到 bbvoid.com,log显示 http 302!

查了好久,突然想明白,尼玛这是二级域名啊,不是host啊,namevirtualhost是针对host的

如果要改成这样,需要用到mod_rewrite才行,自行google
我为了图简单,直接就这样搞了:

<VirtualHost *:80>
    
    DocumentRoot /var/www/goagent
    ServerName 23.244.x.x
    ErrorLog /var/log/httpd/goagent.bbvoid.com_log
    CustomLog /var/log/httpd/goagent.bbvoid.com_log common
</VirtualHost>

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。