nginx设置重写规则

server

      {

              listen       80;

              server_name  www.test.com test.com;

 

             charset utf-8;

 

                    root /Users/macbookpro/ky/test/www;

 

                          location / {

                    index index.html index.htm index.php index.shtml;

 

                    if (!-e $request_filename){

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

 

                    }

              }

 

               location ~ .php

              {

 

                   fastcgi_pass    127.0.0.1:9000;

                   fastcgi_split_path_info ^(.+.php)(.*)$;

                   fastcgi_param PATH_INFO $fastcgi_path_info;

                   fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;

                   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

                   fastcgi_param RUNTIME_ENVIROMENT "lihongsheng";

                   include         fastcgi_params;

                   fastcgi_connect_timeout 300;

                   fastcgi_send_timeout 300;

                   fastcgi_read_timeout 300;

              }

 

 

     }

原文地址:https://www.cnblogs.com/phplhs/p/5548106.html