Nginx 不带www跳转www http跳转https

server
{
listen 443 ssl http2;
server_name www.windxx.com windxx.com;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/taotuba;

#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
#error_page 404/404.html;
ssl_certificate /etc/letsencrypt/live/www.windxx.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.windxx.com/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
if ($host != 'www.windxx.com' ) {
rewrite ^/(.*)$ https://www.windxx.com/$1 permanent;
}
if ($request_uri ~* "/?s=\[&wp-admin") {
return 403;
}
#SSL-END

#ERROR-PAGE-START 错误页配置,可以注释、删除或修改
#error_page 404 /404.html;
#error_page 502 /502.html;
#ERROR-PAGE-END

#PHP-INFO-START PHP引用配置,可以注释或修改
include enable-php-70.conf;
#PHP-INFO-END

#REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
include /www/server/panel/vhost/rewrite/www.windxx.com.conf;
#REWRITE-END
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.project|LICENSE|README.md)
{
return 404;
}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
access_log off;
}

location ~ .*\.(js|css)?$
{
expires 12h;
access_log off;
}
access_log /www/wwwlogs/www.windxx.com.log;
}
server
{
listen 80;
server_name windxx.com www.windxx.com;
if ($host != 'www.windxx.com' ) {
rewrite ^/(.*)$ https://www.windxx.com/$1 permanent;
}

if ($host != 'windxx.com' ) {
rewrite ^/(.*)$ https://www.windxx.com/$1 permanent;
}
}

 上一篇
 Wordpress获取文章第一张图片为缩略图		Wordpress获取文章第一张图片为缩略图
将下面的代码添加到主题的 functions.php: /** *获取文章第一张图片为缩略图 */ if ( function_exists( 'add_theme_support' ) ) { add_theme_support(
2018-03-11
下一篇 
 wordpress后台编辑网站地址http改成https后,后台进不去了? wordpress后台编辑网站地址http改成https后,后台进不去了?
修改wp-config.php文件,加入 $_SERVER['HTTPS'] = 'on'; define('FORCE_SSL_LOGIN', true); define('FORCE_SSL_ADMIN', true);
2018-03-11
  目录