server {
listen 80;
server_name 域名;
rewrite ^(.*) http://域名:443$1 permanent;
}
server
{
listen 443;
server_name 域名;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/hongbao/public;
#SSL-START SSL相關配置,請勿刪除或修改下一行帶註釋的404規則
#error_page 404/404.html;
#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-71.conf;
#PHP-INFO-END
#REWRITE-START URL重寫規則引用,修改後將導致面板設置的僞靜態規則失效
include /www/server/panel/vhost/rewrite/hb.cnbroach.com.conf;
#REWRITE-END
#禁止訪問的文件或目錄
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
#一鍵申請SSL證書驗證目錄相關設置
location ~ \.well-known{
allow all;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
error_log off;
access_log /dev/null;
}
location ~ .*\.(js|css)?$
{
expires 12h;
error_log off;
access_log /dev/null;
}
access_log /www/wwwlogs/域名.log;
error_log /www/wwwlogs/域名.error.log;
}
Linux系統NGinx配置文件,80端口自動轉443端口(非https)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.