【发布时间】:2012-02-27 06:42:20
【问题描述】:
我的服务器重定向 http://www.mylesgray.com:8080/ -> http://www.mylesgray.com/ 时遇到问题。
这是我的 Nginx default 和 fastcgi_params 配置文件:
https://gist.github.com/1745271
https://gist.github.com/1745313
这很麻烦,因为我正在尝试运行 Nginx w/caching 与 Varnish w/caching on Nginx 的基准测试,看看是否有任何一种优于另一种的性能优势。
因此,我在端口8080 上有直接的 Nginx 带缓存侦听和在端口 80 上的清漆,它将任何非缓存请求转发到 localhost:8080 上的 Nginx,所以显然我想要做的是运行一个 @在http://www.mylesgray.com:8080/ 和http://www.mylesgray.com/ 上进行987654330@ 基准测试以查看差异。
这是curl -I 在各个地址上的结果。
# curl -I http://www.mylesgray.com:8080
HTTP/1.1 301 Moved Permanently
Server: nginx/0.7.65
Date: Sun, 05 Feb 2012 12:07:34 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/5.3.2-1ubuntu4.7ppa5~lucid1
X-Pingback: http://www.mylesgray.com/xmlrpc.php
Location: http://www.mylesgray.com/
# curl -I http://mylesgray.com
HTTP/1.1 301 Moved Permanently
Server: nginx/0.7.65
Content-Type: text/html; charset=UTF-8
X-Powered-By: PHP/5.3.2-1ubuntu4.7ppa5~lucid1
X-Pingback: http://www.mylesgray.com/xmlrpc.php
Location: http://www.mylesgray.com/
Content-Length: 0
Date: Sun, 05 Feb 2012 12:15:51 GMT
X-Varnish: 1419774165 1419774163
Age: 15
Via: 1.1 varnish
Connection: keep-alive
# curl -I http://mylesgray.com:8080
HTTP/1.1 301 Moved Permanently
Server: nginx/0.7.65
Date: Sun, 05 Feb 2012 12:16:08 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/5.3.2-1ubuntu4.7ppa5~lucid1
X-Pingback: http://www.mylesgray.com/xmlrpc.php
Location: http://www.mylesgray.com/
然后运行curl -I http://www.mylesgray.com 给出:
# curl -I http://www.mylesgray.com
HTTP/1.1 200 OK
Server: nginx/0.7.65
Content-Type: text/html; charset=UTF-8
X-Powered-By: PHP/5.3.2-1ubuntu4.7ppa5~lucid1
X-Pingback: http://www.mylesgray.com/xmlrpc.php
Content-Length: 5132
Date: Sun, 05 Feb 2012 12:07:29 GMT
X-Varnish: 1419774133 1419774124
Age: 30
Via: 1.1 varnish
Connection: keep-alive
如您所见,80 由 Varnish 提供服务,8080 由 Nginx 提供服务,但我在 anywhere 找不到任何执行 301 重定向的内容,而不是在 nginx.conf 或 @987654340 中@ 文件,我不相信它是由 Wordpress 本身引起的,但非常容易纠正。
请帮忙,这让我发疯了!
迈尔斯
【问题讨论】:
标签: linux redirect nginx http-status-code-301 varnish