php後臺使用nginx的通常配製和僞靜態配製

僞靜態配製:
location / {
    if (!-e $request_filename){
        rewrite  ^(.*)$  /index.php?s=$1  last;   break;
    }
}

nginx配製:
server
{
    listen 80;
    server_name 47.***.***.***;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/47.***.***.***/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-73.conf;
    #PHP-INFO-END
    
    #REWRITE-START URL重寫規則引用,修改後將致使面板設置的僞靜態規則失效
    include /www/server/panel/vhost/rewrite/47.***.***.***.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/47.***.***.***.log;
    error_log  /www/wwwlogs/47.***.***.***.error.log;
}php

相關文章
相關標籤/搜索