我使用基于端口的方法在虚拟主机模式下在本地计算机(Ubuntu 14.04)上运行Apache。虽然一些虚拟主机工作正常,但是来自Web浏览器的一些虚拟主机调用奇怪地被重定向到某个端口,而该端口不是配置中的那个端口。
/etc/apache2/ports.conf
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf
Listen 80
Listen 81
Listen 82
Listen 83
Listen 84
Listen 85
Listen 88
Listen 1080
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
&#13;
示例/etc/apache2/sites-available/somesite.conf
<VirtualHost *:83>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /home/me/www/thiswebsite.com
<Directory /home/me/www/thiswebsite.com>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
&#13;
虽然
http://localhost:80 ... http://localhost:83
按预期工作,端口83上方的某些端口被重定向到该端口83:这意味着,如果我呼叫http://localhost:85
,浏览器会自动重定向到http://localhost:83
并连接到错误的webroot。这也适用于http://localhost:86
或http://localhost:87
等等。所有本地webroots都已通过#&gt; a2ensite thiswebsite.com.conf ...
这种行为可能是什么原因,我该如何解决这个问题?非常感谢您的帮助。最好 Bunjip