簡單配置nginx使之支持pathinfo


  1. 只需要修改3個地方就可以了,親測成功,看代碼有注解
  2. location ~ \.php { #去掉$
    root E:/phpStudy/WWW/tp/public/;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_split_path_info ^(.+\.php)(.*)$; #增加這一句
    fastcgi_param PATH_INFO $fastcgi_path_info; #增加這一句
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;

  3. 下面是我完整的一個虛擬域名配置
  4. server {
    listen 80;
    server_name www.cs.com;
    root "E:/phpStudy/WWW/cs/public/";
    location / {
    index index.html index.htm index.php l.php;
    autoindex on;
    try_files $uri $uri/ /index.php?s=$uri&$args;
    }




    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root html;
    }
    location ~ \.php { #去掉$
    root E:/phpStudy/WWW/cs/public/;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_split_path_info ^(.+\.php)(.*)$; #增加這一句
    fastcgi_param PATH_INFO $fastcgi_path_info; #增加這一句
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;

    }

    }

 如果要看tinkphp5的nginx配置文件的話 這里有位大神給出了具體方式 傳送門:http://www.thinkphp.cn/topic/40391.html

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM