nginx 配置使用index.php作為目錄的默認加載文件


配置如下:

在server增加一行:

index index.php index.html index.htm default.php default.htm default.html

增加后如下:

server
{
    listen 100;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/manager/public;
 
    include enable-php-70.conf;
 
        if (!-e $request_filename) {
                rewrite ^/(.+)$ /index.php last;
        }
 
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
                expires 30d;
        }
        location ~ .*\.(js|css)?$
        {
                expires 1h;
        }
        location /.git
        {
                deny all;
                return 403;
        }
    access_log  /www/wwwlogs/manager.com.log;
    error_log  /www/wwwlogs/manager.com.error.log;
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM