【发布时间】:2014-02-17 01:19:29
【问题描述】:
我在 httpd.conf 中这样设置 VirtualHost:
<VirtualHost xxx.255.118.79:80>
ServerAdmin hoge@hoge.foo.com
DocumentRoot /var/www/html
ServerName main.foo.com
ErrorLog logs/main.foo.com-error_log
TransferLog logs/main.foo.com-access_log
</VirtualHost>
<VirtualHost xxx.255.118.79:8080>
ServerAdmin hoge@hoge.foo.com
DocumentRoot /opt/another_www/
ServerName anotherhost.foo.com
ErrorLog logs/host.foo.com-error_log
TransferLog logs/host.foo.com-access_log
</VirtualHost>
使用 httpd -S 看起来没问题。
[iron@birdwatch html]$ sudo httpd -S
VirtualHost configuration:
xxx.255.118.79:80 main.foo.com (/etc/httpd/conf/httpd.conf:1012)
xxx.255.118.79:8080 anotherhost.foo.com (/etc/httpd/conf/httpd.conf:1020)
Syntax OK
但是当我访问http://xxx.255.118.79:8080 时,它仍然访问/var/www/html。 你能告诉我如何让 apache2 为端口 8080 服务 /opt/another_www 吗?
谢谢!
【问题讨论】:
标签: apache