在上次博客中我通过修改正则表达式达到了使302不继续循环下去,但同时又出现了一个新问题,我的nginx.conf配置如下:
server {
listen 8080;
server_name atstest.mytest1.com atstest.mytest1.com.cn;
if ($server_name = "atstest.mytest1.com"){
rewrite ^/((?!test).)*$ redirect; #注意192.168.10.74是我nginx本身服务器的ip,即实现302跳转到本服务器,不知道这种本服务器302跳转到本服务器是否可行
}
location / {
root /usr/local/nginx1.7.11/html/;
index index.html index.htm;
}
}
我的wget请求如下:
[root@localhost logs]# wget "" -S
--2015-07-10 10:46:49--
Connecting to 192.168.10.74:8080... connected.
HTTP request sent, awaiting response...
HTTP/1.1 302 Moved Temporarily
Server: nginx/1.7.11
Date: Fri, 10 Jul 2015 02:46:49 GMT
Content-Type: text/html
Content-Length: 161
Connection: keep-alive
Location:
Location: [following]
--2015-07-10 10:46:49--
Reusing existing connection to 192.168.10.74:8080.
HTTP request sent, awaiting response...
HTTP/1.1 404 Not Found
Server: nginx/1.7.11
Date: Fri, 10 Jul 2015 02:46:49 GMT
Content-Type: text/html
Content-Length: 169
Connection: keep-alive
2015-07-10 10:46:49 ERROR 404: Not Found.
302到的location不是预期的,而是
不知道是为什么?请求高人指点
阅读(8010) | 评论(0) | 转发(0) |