nginx 解决伪静态,服务器500错误 --- 2021-11

2021-11-08  本文已影响0人  一位先生_

个人项目nginx配置项目实例代码(解决伪静态,服务器500错误)


server {

        listen 80 default_server reuseport;

        server_name _;

        root  /home/wwwroot/tp6/public;

        index  index.php index.html index.htm;

        location / {

            if (!-e $request_filename) {

                rewrite ^/index.php(.*)$ /index.php?s=$1 last;

                rewrite ^(.*)$ /index.php?s=$1 last;

                break;

            }

        }

        location ~ \.php$ {

            root          /home/wwwroot/tp6/public;

            fastcgi_pass  127.0.0.1:9000;

            fastcgi_index  index.php;

            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;

            include        fastcgi_params;

        }

    }

上一篇 下一篇

猜你喜欢

热点阅读