问答

lnmp搭建易优CMS站点配置报500错误

2018-08-14 admin
首页可以访问,其他页面全是500

问题答疑

1、概述
易优CMS核心采用thinkphp5,有些nginx服务器不能访问,是因为要开启pathinfo。
 
2、配置
修改 php.ini 支持 pathinfo
php配置文件:/usr/local/php/etc/php.ini
更改php.ini
找到:cgi.fix_pathinfo=0  更改为:cgi.fix_pathinfo=1
找到:scandir,去掉禁止函数中的 scandir
 
3、配置nginx新站点
server
    {
        listen 80;
        server_name www.xxxxxxx.com xxxxxxx.com;
        index index.php index.html index.htm default.html default.htm default.php;
        root  /home/wwwroot/www.xxxxxxx.com/;
 
        include none.conf;
        #error_page   404   /404.html;
        #include enable-php.conf;
        include enable-php-pathinfo.conf;
 
        location / {
            if (!-e $request_filename) {
                rewrite ^(.*)$ /index.php?s=/$1 last;
                break;
            }
        }
 
        if ($host != 'www.xxxxxxx.com' ) {
            rewrite ^/(.*)$ http://www.xxxxxxx.com/$1
            permanent;
        }
 
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }
 
        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }
 
        location ~ /\.
        {
            deny all;
        }
 
        #access_log  /home/wwwlogs/www.xxxxxxx.com.log;
    }

如果没有就创建enable-php-pathinfo.conf 文件代码:
location ~ [^/]\.php(/|$)
{
    fastcgi_pass unix:/dev/shm/php-cgi.sock;
    fastcgi_index index.php;
    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    set $path_info $fastcgi_path_info;
    fastcgi_param PATH_INFO       $path_info;
    try_files $fastcgi_script_name =404;
    include fastcgi.conf;
}

 
4、重启
lnmp restart


QQ在线咨询