http跳转https总是提示多次定向,请帮忙看看这配置哪里出问题了
想让http://www.xxx.com 跳转到https://www.xxx.com但这样配置后就会提示重定向次数过多
请帮忙看看是哪里错了
谢谢啊
server
{
listen 80;
#listen [::]:80;
server_name www.xxx.com ;
return 301 https://www.xxx.com$request_uri;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/XXX;
include discuzx.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log off;
}
server
{
listen 443 ssl http2;
#listen [::]:443 ssl http2;
server_name www.xxx.com ;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/xxx;
ssl on;
ssl_certificate /usr/local/nginx/conf/ssl/www.xxx.com.crt;
ssl_certificate_key /usr/local/nginx/conf/ssl/www.xxx.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+CHACHA20:EECDH+CHA0-draft:EECDAES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RDES:!MD5";
ssl_session_cache builtin:1000 shared:SSL:10m;
# openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;
include discuzx.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log off;
}
[ 本帖最后由 独孤羽 于 2018-11-27 22:40 编辑 ] discuz论坛程序.conf 规则里没加301还自动跳转,加一句就重复定向了。
好郁闷,不知道还有哪里加了301 定向,找了好几天也没找出来 这个配置文件上并没有导致重复301的设置
之前是否设置301出错,浏览器是否清空缓存试过
curl -IL http://www.xxx.com 看一下 浏览器也清空缓存试了,
用军哥的命令看了是这样,啥意思哈,不太懂。
root@localhost ~]# curl -IL www.xxx.net
HTTP/1.1 301 Moved Permanently
Server: NWS_SP
Connection: keep-alive
Date: Wed, 28 Nov 2018 06:04:15 GMT
Content-Length: 22
Location: https://www.xxx.net/
HTTP/1.1 564
Server: NWSs
Date: Wed, 28 Nov 2018 06:04:17 GMT
Content-Length: 0
Connection: keep-alive
X-NWS-LOG-UUID: d02d1f31-e6ea-4284-ac91-cb5ff81ff902 关闭腾讯cdn的301后是这样
curl -IL www.xxx.net
curl: (56) Recv failure: Connection reset by peer
#
即使我关掉腾讯cdn的301,清除浏览器缓存后,自己加上一楼的那个定向还是会出现重复定向的现象。
我现在就是不想用腾讯的301,但关掉后,自己加上总是出现重复定向。
不知道是哪里的问题呢
[ 本帖最后由 独孤羽 于 2018-11-28 14:24 编辑 ]
回复 4# 的帖子
564的错误代码可能你源站有问题关闭cdn还是无法访问你服务器上可能有问题
如果不用cdn正常的话就是你cdn的锅 军哥,564的错误代码,请问怎么办?
页:
[1]