关于nginx虚拟目录的PHP文件不能被运行
flfq
|
1#
flfq 发表于 2008-10-24 04:17
关于nginx虚拟目录的PHP文件不能被运行
网站
http://192.168.1.10 根目录为 /data/www/wwwroot 其中有个虚拟目录URL为http://192.168.1.10/uc 地址为 /data/www/admin 发现凡是/data/www/admin里的PHP文件都报404错误
QUOTE:
os: Freebsd 7.1 AMD64
php: 5.2.6 nginx : 0.6.32 php的php.ini没有动过,默认值 nginx.con如下
QUOTE:
user www www;
worker_processes 4; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; pid /var/run/nginx.pid; events { use kqueue; worker_connections 1024; } http { include mime.types; # include vhosts/php5.conf; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] $request ' # '"$status" $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; #=============vhosts config============= include vhosts/vhosts.conf; # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443; # server_name localhost; # ssl on; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_timeout 5m; # ssl_protocols SSLv2 SSLv3 TLSv1; # ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} } vhost/php5.conf如下
QUOTE:
#fastcgi_pass 127.0.0.1:9980;
#fastcgi_index index.php; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx; ##new ac upload fastcgi_pass_request_body on; client_body_in_file_only clean; fastcgi_param REQUEST_BODY_FILE $request_body_file; ## fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; # PHP only, required if PHP was built with --enable-force-cgi-redirect fastcgi_param REDIRECT_STATUS 200; vhost/vhost.conf如下
QUOTE:
server
{ listen 80; server_name localhost; root /data/www/wwwroot; index index.html index.htm index.php; location /uc/ { alias /data/www/admin/; index index.html index.htm index.php; } location ~ .*\.php?$ { fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include vhosts/php5.conf; fastcgi_pass 127.0.0.1:9980; } # location ~^/uc/.*\php?$ # { # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # include vhosts/php5.conf; # fastcgi_pass 127.0.0.1:9980; # } } 官方教程被翻个遍了还没有解决方案 |