我已经将Apache虚拟主机配置为在端口8000处运行,而在Apache前面,我在端口80上配置了Varnish。问题是,如果我将其粘贴到浏览器中:
Example.com/a_目录
我被重定向到example.com:8000/a_目录
我无法连接错误。在配置文件中,我有以下内容:
<VirtualHost *:8000>
ServerAdmin xxx@xxx.org.au
DocumentRoot /var/www
DirectoryIndex index.php index.html index.htm
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www>
AllowOverride All
</Directory>
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>发布于 2011-11-29 02:50:28
这几乎可以肯定是由于自引用重定向造成的,例如,当目录请求中缺少尾随斜杠时。在这种情况下,在没有ServerName指令的情况下,Apache将使用请求所在的端口--在您的示例中是8000。在Apache2.x中,ServerName指令支持用于构建重定向的端口说明符。来自Apache文档:
ServerName指令设置服务器用来标识自身的请求方案、主机名和端口。这在创建重定向URL时使用。
在vhost块中添加类似于(显然改变了您的环境)的ServerName www.foo.com:80,它应该告诉Apache使用上游代理端口构建这些重定向,而不是它正在监听的端口。
有关此指令的更多信息,请参见http://httpd.apache.org/docs/2.2/mod/core.html。
https://serverfault.com/questions/335444
复制相似问题