nginx conf 文件

server
    {
        listen 80;
        server_name local.light.com;
        index index.html index.htm index.php;
        root  /home/wwwroot/default/******/Public;      // !!!! 所在的文件需要有可执行权限, 一般是755 的权限,否则会报403 找不到文件 的错误

        #error_page   404   /404.html;
        include enable-php-pathinfo.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 ~ /.
        {
            deny all;
        }

        access_log  /home/wwwlogs/access_****.log;
    }



        include enable-php-pathinfo.conf;  这里很重要  有时候引入enable-php.conf 文件
     如果这里注释掉,将解析不了php文件,就会出现访问php文件,直接下载了php文件的发生!
 
原文地址:https://www.cnblogs.com/pansidong/p/11124486.html