再问path info问题,还没有搞好,老大帮看一下
要配置支持 path_info以前问过这个问题 按老大给的nginx官方的方法 https://bbs.vpser.net/thread-1468-1-1.html同时也google了 好多
但我咋就搞不好呢,哪里错了,望给指点一下 代码如下
conf/nginx.conf的代码userwww www;
worker_processes 4;
error_log/home/wwwroot/logs/nginx_error.logcrit;
pid /usr/local/nginx/logs/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;
events
{
use epoll;
worker_connections 51200;
}
http
{
include mime.types;
default_typeapplication/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;
gzip on;
gzip_min_length1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
#limit_zonecrawler$binary_remote_addr10m;
server
{
listen 80;
server_name www.testsite.com;
index index.html index.htm index.php;
root/home/wwwroot;
location ~ ^(.+\.php)(.*)$
{
fastcgi_passunix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME /path/to/php$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fcgi.conf;
}
location /status {
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
log_formataccess'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log/home/wwwroot/logs/access.logaccess;
}
include vhost/*.conf;
}/vhost/my.testsite.com.conf的代码server
{
listen 80;
server_name my.testsite.com;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/my.testsite.com;
include none.conf;
location ~ .*\.(php|php5)?$
{
fastcgi_passunix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log off;
}另一个虚拟主机的 conf文件server
{
listen 80;
server_name my2.testsite.com;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/my2.testsite.com;
include none.conf;
location ~ ^(.+\.php)(.*)$
{
fastcgi_passunix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME /path/to/php$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log off;
}可还是不行,老大帮看一下 那里错了
[ 本帖最后由 孤独剑客 于 2010-8-9 18:14 编辑 ] # /root/lnmp restart
=========================================================================
Manager for LNMP V0.4,Written by Licess
=========================================================================
LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux
This script is a tool to Manage status of lnmp
For more information please visit http://www.lnmp.org
Usage: /root/lnmp {start|stop|reload|restart|kill|status}
=========================================================================
Reload LNMP...
Reload Nginx configure...
the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
configuration file /usr/local/nginx/conf/nginx.conf test is successful
Nginx program is reloding!
Shutting down MySQL.
Starting MySQL.
Shutting down php_fpm . done
Starting php_fpmdone 自己顶一下 不顶就陈了 原帖由 孤独剑客 于 2010-8-8 21:00 发表 https://bbs.vpser.net/images/common/back.gif
# /root/lnmp restart
=========================================================================
Manager for LNMP V0.4,Written by Licess
=========================================== ...
我看不出 那里错了 不好意思:( 在顶一下 等斑竹回复 呵呵
回复 1# 的帖子
添加的太生硬了。。。fastcgi_param SCRIPT_FILENAME /path/to/php$fastcgi_script_name;//这个在原来的配置中已经有了,而且其他的/path/to/php 要替换为路径。只填加下面的填加到fcgi.conf中就可以了。
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; 折腾了好几天,又重装了系统,还是么有支持下面是代码
fcgi.conf# cat fcgi.conf
fastcgi_paramGATEWAY_INTERFACECGI/1.1;
fastcgi_paramSERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_paramQUERY_STRING $query_string;
fastcgi_paramREQUEST_METHOD $request_method;
fastcgi_paramCONTENT_TYPE $content_type;
fastcgi_paramCONTENT_LENGTH $content_length;
fastcgi_paramSCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_paramSCRIPT_NAME $fastcgi_script_name;
fastcgi_paramREQUEST_URI $request_uri;
fastcgi_paramDOCUMENT_URI $document_uri;
fastcgi_paramDOCUMENT_ROOT $document_root;
fastcgi_paramSERVER_PROTOCOL $server_protocol;
fastcgi_paramREMOTE_ADDR $remote_addr;
fastcgi_paramREMOTE_PORT $remote_port;
fastcgi_paramSERVER_ADDR $server_addr;
fastcgi_paramSERVER_PORT $server_port;
fastcgi_paramSERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_paramREDIRECT_STATUS 200;
# http://www.lvyou.jp/a.jpg 按 熊哥的提示修改的 fcgi.conf
fastcgi_paramGATEWAY_INTERFACECGI/1.1;
fastcgi_paramSERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
fastcgi_paramQUERY_STRING $query_string;
fastcgi_paramREQUEST_METHOD $request_method;
fastcgi_paramCONTENT_TYPE $content_type;
fastcgi_paramCONTENT_LENGTH $content_length;
#fastcgi_paramSCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_paramSCRIPT_NAME $fastcgi_script_name;
fastcgi_paramREQUEST_URI $request_uri;
fastcgi_paramDOCUMENT_URI $document_uri;
fastcgi_paramDOCUMENT_ROOT $document_root;
fastcgi_paramSERVER_PROTOCOL $server_protocol;
fastcgi_paramREMOTE_ADDR $remote_addr;
fastcgi_paramREMOTE_PORT $remote_port;
fastcgi_paramSERVER_ADDR $server_addr;
fastcgi_paramSERVER_PORT $server_port;
fastcgi_paramSERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_paramREDIRECT_STATUS 200;
#
把nginx.conf 和虚拟主机的.conf 还有 fcgi.conf 都加上了
nginx.conf的# cat nginx.confuserwww www;
worker_processes 1;
error_log/home/wwwroot/logs/nginx_error.logcrit;
pid /usr/local/nginx/logs/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this
process.
worker_rlimit_nofile 51200;
events
{
use epoll;
worker_connections 51200;
}
http
{
include mime.types;
default_typeapplication/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;
gzip on;
gzip_min_length1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript
text/css application/xml;
gzip_vary on;
#limit_zonecrawler$binary_remote_addr10m;
server
{
listen 80;
server_name li.testsite.com;
index index.html index.htm index.php;
root/home/wwwroot;
location ~ .*\.(php|php5)?$
{
fastcgi_passunix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location /status {
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
log_formataccess'$remote_addr - $remote_user
[$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log/home/wwwroot/logs/access.logaccess;
}
include vhost/*.conf;
}##################################################################
虚拟主机的 .conf# cat www.lvyou.jp.conf
server
{
listen 80;
server_name www.lvyou.jp;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/www.lvyou.jp;
include lvyou.jp.conf;
location ~ .*\.(php|php5)?$
{
fastcgi_passunix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log off;
}
# ##################################################
fcgi.conf的这里试过两个 一个是军哥给的,一个是熊哥提供,但都不成
首先是按军哥的提示 改的 再本贴7楼
https://bbs.vpser.net/viewthread.php?tid=1534&page=1&fromuid=1710#pid2068
另一个是 按熊哥提供的
#fastcgi_pass 127.0.0.1:9000;
##fastcgi_indexindex.php;
set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
if ( $fastcgi_script_name ~ \..*\/.*php ) {
return 403;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
##
fastcgi_paramGATEWAY_INTERFACECGI/1.1;
fastcgi_paramSERVER_SOFTWARE nginx;
fastcgi_paramQUERY_STRING $query_string;
fastcgi_paramREQUEST_METHOD $request_method;
fastcgi_paramCONTENT_TYPE $content_type;
fastcgi_paramCONTENT_LENGTH $content_length;
#fastcgi_paramSCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_paramSCRIPT_NAME $fastcgi_script_name;
fastcgi_paramREQUEST_URI $request_uri;
fastcgi_paramDOCUMENT_URI $document_uri;
fastcgi_paramDOCUMENT_ROOT $document_root;
fastcgi_paramSERVER_PROTOCOL $server_protocol;
fastcgi_paramREMOTE_ADDR $remote_addr;
fastcgi_paramREMOTE_PORT $remote_port;
fastcgi_paramSERVER_ADDR $server_addr;
fastcgi_paramSERVER_PORT $server_port;
fastcgi_paramSERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_paramREDIRECT_STATUS 200;
[ 本帖最后由 孤独剑客 于 2010-8-13 14:21 编辑 ]
页:
[1]