没有用ThinkPHP框架在nginx中的配置:
server {
listen 80;
server_name zx.server110.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root d:/webroot/zx.server110.com;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ .php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ .php$ {
root d:/webroot/zx.server110.com;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /.ht {
# deny all;
#}
}
用ThinkPHP框架在nginx中的配置:
server {
listen 80;
server_name user.server110.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root d:/webroot/user.server110.com;
index index.php;
if (!-e $request_filename)
{
rewrite ^/user.server110.com/(.*)$ /user.server110.com/index.php/$1 last;
break;
}
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ .php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ .+.php($|/)
{
root d:/webroot/user.server110.com;
set $script $uri;
set $path_info "/";
if ($uri ~ "^(.+.php)(/.+)")
{
set $script $1;
set $path_info $2;
}
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;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /.ht {
# deny all;
#}
}
这两种配置中不同的地方就是新加的代码。
声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。