nginx 配置 適用thinkphp

  1. server {  

  2.  ...  

  3.     location / {  

  4.         index  index.htm index.html index.php;  

  5.         #如果文件不存在則嘗試TP解析  

  6.         try_files  $uri  /index.php$uri;  

  7.     }  

  8.     location ~ .+\.php($|/) {  

  9.         root        /var/www/html/website;  

  10.         fastcgi_pass   127.0.0.1:9000;  

  11.         fastcgi_index  index.php;  

  12.           

  13.         #設置PATH_INFO,注意fastcgi_split_path_info已經自動改寫了fastcgi_script_name變量,  

  14.         #後面不需要再改寫SCRIPT_FILENAME,SCRIPT_NAME環境變量,所以必須在加載fastcgi.conf之前設置  

  15.         fastcgi_split_path_info  ^(.+\.php)(/.*)$;  

  16.         fastcgi_param  PATH_INFO $fastcgi_path_info;  

  17.           

  18.         #加載Nginx默認"服務器環境變量"配置  

  19.         include        fastcgi.conf;  

  20.     }  

  21. }  



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章