无法取消http301跳转https
军哥,请问我之前申请了letsencrypt证书,后来设置了访问http自动301重定向https,但是现在我需要以普通http的方式打开链接,就是说不要301重定向https,但是我无论怎么修改/usr/local/nginx/conf/vhost/下相应的文件,修改完上传,nginx服务器也重启了,甚至连主机也重启了,还是自动跳转https,我甚至把网站的数据库和文件全部删除也不行,只要访问这个域名就自动跳转https访问。请问我该如何修改?附带我以前http301重定向https成功的方法,我该如何修改?请告诉我,谢谢!server
{
listen 80;
server_name xxx.com www.xxx.com;
index index.html index.htm index.php default.html default.htm default.php;
location /.well-known/ {
add_header Content-Type 'text/plain;';
root /home/wwwroot/www.xxx.com;
}
location / {
return 301 https://www.xxx.com$request_uri;
}
}
server
{
listen 443 ssl http2;
server_name xxx.com www.xxx.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/www.xxx.com;
ssl_certificate /etc/letsencrypt/live/www.xxx.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.xxx.com/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_timeout 10m;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_buffer_size 1400;
add_header Strict-Transport-Security max-age=15768000;
ssl_stapling on;
ssl_stapling_verify on;
include wordpress.conf;
#error_page 404 /404.html;
location ~ [^/]\.php(/|$)
{
# comment try_files $uri =404; to enable pathinfo
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
#include pathinfo.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log/home/wwwlogs/www.xxx.com.log;
}
[ 本帖最后由 Chilsion 于 2016-8-12 23:43 编辑 ] 因为你加了 add_header Strict-Transport-Security max-age=15768000;
这是HSTS强制http到https的
及时你在服务器上去除了该配置,浏览器上有HSTS缓存的话也是不起作用,也就是只有你有HSTS的时候访问过,就没法改变,除非缓存到期或删除当前浏览器,chrome的话可以chrome://net-internals/#hsts 里可以自己删除HSTS记录
HSTS是一个很严谨的东西,不适合你想加就加想去就去
回复 2# 的帖子
谢谢军哥!:handshake
页:
[1]