nginx php pathinfo 模式配置

server {
        listen 80;
        server_name mgr.wchatool.com;
        index index.html index.php;
        root /alidata/www/webmanage/zmht;
        autoindex off;
        fastcgi_connect_timeout 1200;
        fastcgi_send_timeout 1200;
        fastcgi_read_timeout 1200;

#       location ~ .*.(php|php5)?$
#        {
#            fastcgi_pass  127.0.0.1:9000;
#            fastcgi_index index.php;
#            include fastcgi.conf;
#
#        }
#       location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
#       {
#            expires 30d;
#       }
#       location ~ .*.(js|css)?$
#       {
#            expires 1h;
#       }


        location / {
        if (!-e $request_filename) {
        rewrite  ^/(.*)$  /index.php/$1  last;
        break;
        }
        }

        location ~ .php {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        set $real_script_name $fastcgi_script_name;
        if ($fastcgi_script_name ~ "^(.+?.php)(/.+)$") {
        set $real_script_name $1;
        set $path_info $2;
        }
        fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
        fastcgi_param SCRIPT_NAME $real_script_name;
        fastcgi_param PATH_INFO $path_info;
        }


        error_page  404  /404.html;
        access_log off;
        error_log  /alidata/log/nginx/error/webmanage.log;
}

  

原文地址:https://www.cnblogs.com/leescre/p/8004135.html