带www域名死活不跳转https
简单说下情况,个人博客已经用lnmp申请了证书,按照301教程设置,带www的域名死活不跳转https,而不带www的正常跳转到https。同样按照教程设置https:xlovett.com跳转https:www.xlovett.com也是死活不成功。没办法只能设置个hsts凑合用,https:xlovett.com跳转https:www.xlovett.com只能先不管了。大佬,帮我看下为什么www域名死活不跳转https?server
{
listen 80;
#listen [::]:80;
server_name www.xlovett.com xlovett.com;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/www.xlovett.com;
return 301 https://www.xlovett.com$request_uri;
include rewrite/wordpress.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-pathinfo.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/home/wwwlogs/www.xlovett.com.log;
}
server
{
listen 443 ssl http2;
#listen [::]:443 ssl http2;
server_name www.xlovett.com ;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/www.xlovett.com;
ssl on;
ssl_certificate /usr/local/nginx/conf/ssl/www.xlovett.com/fullchain.cer;
ssl_certificate_key /usr/local/nginx/conf/ssl/www.xlovett.com/www.xlovett.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!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 rewrite/wordpress.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-pathinfo.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/home/wwwlogs/www.xlovett.com.log;
}
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"; http的www域名不跳https 不清楚什么原因,配置文件上没问题,除了你是wordpress程序你开启pathinfo
现在看你现在就是 https不带www跳到 https 带www的
另外wordpress本身就是带301的,如你用www域名安装的,不带www的会自动301到带www的;你如果要一直用https,先去wp设置看看是否已经都设置为https的
回复 2# 的帖子
我实在是没点子了,其实这个问题已经困扰我一个多月,试了各种办法都没用。要不我把网站后台ip和密码给大佬,帮我看下顺带修改下,可以?回复 3# 的帖子
可以qq或旺旺上联系付费排查
页:
[1]