美文网首页
lnmp的pathinfo规则

lnmp的pathinfo规则

作者: Mracale | 来源:发表于2021-04-28 09:07 被阅读0次
server {
    listen       80;
    root   /usr/share/nginx/tpf/public;
    server_name  vm.tpf.com;

    gzip on;
    index index.php index.html index.htm index.nginx-debian.html;
    #根目录下面的其他文件夹不能访问php文件
    location ~* ^/(upload|static|log)/.*\.(php|php5)$
    {
      deny all;
    }       

    location / {
        try_files $uri $uri/ =404;
        if (!-e $request_filename){
            rewrite ^/(.*)$ /index.php?s=/$1 last;
            break;
        }
    }

    location ~ .php$ {
       fastcgi_pass   127.0.0.1:9000;
       fastcgi_index  index.php;
       fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
       include        fastcgi_params;
    }

    error_page   500 502 503 504  /50x.html;

    error_log  /home/mracale/www.err;
    access_log  /home/mracale/www.log;
}

相关文章

网友评论

      本文标题:lnmp的pathinfo规则

      本文链接:https://www.haomeiwen.com/subject/yxxprltx.html