标题:
[求助]
SSL开启强制使用,但并不跳转,是否原因如下:
[打印本页]
作者:
cici9911
时间:
2017-8-10 09:47
标题:
SSL开启强制使用,但并不跳转,是否原因如下:
wdCP版本为 v3.2.12。站点已经成功上传cert和key文件,并且设置
强制开启
SSL,并且http和https均可以正常打开访问站点,但是用http访问的时候,并不会强制跳转到https,请问是什么情况!目前是A+N引擎!强制开启SSL后,发现nginx的conf文件并没有什么变化,还是如下:
server {
listen 80;
root /www/web/xxx_com/public_html;
server_name xxx.com www.xxx.com;
index index.html index.php index.htm;
error_page 400 /errpage/400.html;
error_page 403 /errpage/403.html;
error_page 404 /errpage/404.html;
error_page 503 /errpage/503.html;
location ~ \.php$ {
proxy_pass http://127.0.0.1:88;
include naproxy.conf;
}
location ~ /\.ht {
deny all;
}
location / {
try_files $uri @apache;
}
location @apache {
internal;
proxy_pass http://127.0.0.1:88;
include naproxy.conf;
}
}
复制代码
另外,参照其他教程分别尝试添加了如下代码,添加后http和https均无法正常访问:
代码1:
if ($server_port = 80) {
return 301 https://$host$request_uri;
}
复制代码
代码2:
listen 443 ssl;
ssl on;
ssl_certificate /www/wdlinux/nginx/conf/cert/xxx.com.cert;
ssl_certificate_key /www/wdlinux/nginx/conf/cert/xxx.com.key;
复制代码
补充一句:我用了cloudflare的CND加速,是否和这个有关?
作者:
cici9911
时间:
2017-8-10 15:26
重装了vps系统和wdcp,问题得以解决。conf文件有变化!可是新问题出现,打开访问 会存在重定向死循环:
server {
listen 80;
root /www/web/xxx_com/public_html;
server_name xxx.com www.xxx.com;
rewrite ^(.*)$ https://$host$1 permanent;
index index.html index.php index.htm;
error_page 400 /errpage/400.html;
error_page 403 /errpage/403.html;
error_page 404 /errpage/404.html;
error_page 503 /errpage/503.html;
location ~ \.php$ {
proxy_pass http://127.0.0.1:88;
include naproxy.conf;
}
location ~ /\.ht {
deny all;
}
location / {
try_files $uri @apache;
}
location @apache {
internal;
proxy_pass http://127.0.0.1:88;
include naproxy.conf;
}
}
server {
listen 443;
root /www/web/xxx_com/public_html;
ssl on;
ssl_certificate cert/xxx.crt;
ssl_certificate_key cert/sxxx.key;
ssl_prefer_server_ciphers on;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
server_name xxx.com www.xxx.com;
index index.html index.php index.htm;
error_page 400 /errpage/400.html;
error_page 403 /errpage/403.html;
error_page 404 /errpage/404.html;
error_page 503 /errpage/503.html;
location ~ \.php$ {
proxy_pass http://127.0.0.1:88;
include naproxy.conf;
}
location ~ /\.ht {
deny all;
}
location / {
try_files $uri @apache;
}
location @apache {
internal;
proxy_pass http://127.0.0.1:88;
include naproxy.conf;
}
}
复制代码
另外,选择https启用(非强制启用)一切正常,最奇怪的是,选择不启用,https依然可以正常访问!
欢迎光临 WDlinux官方论坛 (http://wdlinux.cn/bbs/)
Powered by Discuz! 7.2