小编Vil*_*ila的帖子

即使我从conf中删除了规则,Nginx仍然会重定向

我使用此块将网站的 IP 重定向到实际的 URL:

# IP to domain redirect
server {
        # tell on which port this server listens
        listen [::]:80;
        listen 80;

        # listen on the IP
        server_name xx.xx.xx.xxx;

        # and redirect to the domain
        return 301 $scheme://example.com$request_uri;
}
Run Code Online (Sandbox Code Playgroud)

然而我决定删除它,但重定向并没有消失。我知道我的浏览器已经硬缓存了该重定向,我看不到更改,因此我curl -I xx.xx.xx.xxx通过 SSH 查看响应,其中 xx.xx.xx.xxx 是服务器的公共 IP:

HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Tue, 10 Jan 2017 14:06:01 GMT
Content-Type: text/html
Content-Length: 178
Connection: keep-alive
Location: http://example.com/
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
X-UA-Compatible: IE=Edge
Run Code Online (Sandbox Code Playgroud)

如您所见,重定向仍然存在。此外,我从第三方源 ping …

nginx domain ip redirect 301-redirect

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

301-redirect ×1

domain ×1

ip ×1

nginx ×1

redirect ×1