tp3.2+nginx支持path_info

server {
        listen    80;
        server_name  域名;
        index index.html  index.htm  index.php;
        root 项目目录;
        location ~* ^/(application|Thinkphp|Uploads)/.*\.(php|php5)$    #此处根据项目实际情况处理
        {
                deny all;

        }

        #此处根据项目是否启用rewrite规则来决定是否要开启

        if (!-e $request_filename){

            rewrite ^/(.*)$ /index.php/$1& last;

        }

        location ~ .*\.php($|/)
        {
                fastcgi_pass  unix:/tmp/php-cgi-56.sock; #此处根据php-fpm.conf中,listen的配置值设置
                fastcgi_index index.php;
                fastcgi_split_path_info  ^(.+\.php)(.*)$;    #增加这一句
                fastcgi_param  PATH_INFO  $fastcgi_path_info;   #增加这一句
                fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;   #增加这一句
                include fastcgi_params;
        }

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
                expires 30d;
        }
        location ~ .*\.(js|css)?$
        {
                expires 1h;
        }

        error_log  /wwwlog/etpc/error.log crit;
        access_log /wwwlog/etpc/access.log main;

}


启动:systemctl start nginx

报错考虑:

1.php-fpm是否启动

2.日志目录是否创建



猜你喜欢

转载自blog.csdn.net/rock5275/article/details/80571585
今日推荐