NGINX配置301跳转 80跳转到443,HTTP跳到HTTPS SSI引用文件及SSL配置 文件代码如下:
server
{
listen 80;
#listen [::]:80;
listen 443;
ssl on;
ssl_certificate /usr/local/nginx/conf/copycf.com.crt;
ssl_certificate_key /usr/local/nginx/conf/copycf.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
ssi on;
ssi_silent_errors on;
server_name www.copycf.com copycf.com;
if ($host = 'copycf.com'){rewrite ^/(.*)$ http://www.copycf.com/$1 permanent;}
index index.html index.htm index.php default.html default.htm default.php;
root /home/copycfcopy;
if ($scheme = http ) {
return 301 https://$host$request_uri;
}
include other.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 /home/wwwlogs/www.copycf.com.log;
}