//增加 /use/local/nginx/conf/nginx.conf start
server{
listen 80;
server_name www.cacov.cn;
#告诉浏览器有效期内只准用 https 访问
add_header Strict-Transport-Security max-age=15768000;
#永久重定向到 https 站点
return 301 https://$server_name$request_uri;
}
//增加这个server就行 end
server
{
listen 443;
#listen [::]:80 default_server ipv6only=on;
server_name www.cacov.cn;
ssl on;
ssl_certificate 1_www.cacov.cn_bundle.crt;
ssl_certificate_key 2_www.cacov.cn.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;
index index.html index.htm index.php;
root /home/wwwroot/laravel_admin/public;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include proxy-pass-php.conf;
location /nginx_status
{
stub_status on;
access_log off;
}
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/access.log;
}
http重定向到https
猜你喜欢
转载自blog.csdn.net/qq_42805749/article/details/89399417
今日推荐
周排行