zoukankan      html  css  js  c++  java
  • nginx下开启pathinfo模式

      第一种方式是通过重写url来实现pathinfo模式:   

    1 location / {  
    2     if (!-e $request_filename){  
    3         rewrite ^/(.*)$ /index.php?s=/$1 last;  
    4     }  
    5 }  

      第二种方式 ,改变 .php的

     1 location ~ .php {  
     2                 #fastcgi_pass 127.0.0.1:9000;   
     3                 #fastcgi_pass unix:/dev/shm/php-cgi.sock;   
     4                 fastcgi_pass  unix:/tmp/php-cgi.sock;  
     5                 fastcgi_index index.php;  
     6                 include fastcgi.conf;  
     7                 set $real_script_name $fastcgi_script_name;  
     8                 if ($fastcgi_script_name ~ "^(.+?.php)(/.+)$") {  
     9                 set $real_script_name $1;  
    10                 set $path_info $2;  
    11             }  
    12                 fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;  
    13                 fastcgi_param SCRIPT_NAME $real_script_name;  
    14                 fastcgi_param PATH_INFO $path_info;  
    15             }  

      第二种方案没测试通过

  • 相关阅读:
    Git
    Git
    Git
    Git
    Docker
    Linux
    Linux
    Python
    Python
    SQL
  • 原文地址:https://www.cnblogs.com/loveyouyou616/p/6115718.html
Copyright © 2011-2022 走看看