注意使用LNMP 1.4版

 

1、修改php.ini 启用pathinfo

/usr/local/php/etc/php.ini

cgi.fix_pathinfo = 0 值改为1

 

2、修改/usr/local/nginx/conf/vhost/你的网站.conf 配置文件

include enable-php.conf;  替换为 include enable-php-pathinfo.conf;

注意包含thinkphp.conf的路由配置文件

 

配置文件如下所示:

server
    {
        listen 80;
        #listen [::]:80;
        server_name www.abc.com ;
        index index.html index.htm index.php default.html default.htm default.php;
        root  /www/abc;

        include thinkphp.conf;
        #error_page   404   /404.html;

        # Deny access to PHP files in specific directory
        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

        include enable-php-pathinfo.conf;

        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/www.abc.com.log;
    }

 

  

 posted on 2020-05-06 17:04  三哥-Noble  阅读(133)  评论(0编辑  收藏  举报
TOP