nginx上部署thinkphp的解決方法(LNMP 0.9)

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

location ~ .+\.php($|/)
{
set $script $uri;
set $path_info 「/」;
if ($uri ~ 「^(.+\.php)(/.+)」)
{
set $script $1;
set $path_info $2;
}
fastcgi_pass unix:/tmp/php-cgi.sock;
# fastcgi_pass 127.0.0.1:9000;
include fastcgi.conf;
fastcgi_index index.php?IF_REWRITE=1;
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root/$script;
fastcgi_param SCRIPT_NAME $script;
} nginx

而後項目配置下url模式改成2 url

'URL_MODEL'=>2, unix

若是是多個項目,佈署項目時要把項目佈署到目錄裏,如後臺的項目放到Admin目錄裏,那麼在nginx的rewrite裏再寫一條 ip

 

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

相關文章
相關標籤/搜索