我有这样的configuration:
worker_processes 2; error_log logs/error.log; pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 64; access_log logs/access.log; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 75 20; gzip on; gzip_comp_level 1; gzip_proxied any; gzip_min_length 1100; gzip_buffers 4 8k; gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; server { listen 80; server_name localhost; access_log logs/host.access.log; location / { root /var/www; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/www; } location ~* ^.+\.(jpg|jpeg|gif)$ { root /var/www; access_log off; expires 30d; } location ~ /\.ht { deny all; } location ~ ^/~(.+?)(/.*)?$ { alias /home/$1/public_html$2; index index.html index.htm; autoindex on; location ~ \.php$ { root /home/$1/public_html; include php_fastcgi.conf; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } } location ~ \.php$ { root /var/www; include php_fastcgi.conf; fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name; } }
其中php_fastcgi.conf文件的内容是这样的:
fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_connect_timeout 60; fastcgi_send_timeout 180; fastcgi_read_timeout 180; fastcgi_buffer_size 128k; fastcgi_buffers 4 256k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; fastcgi_intercept_errors on;
如果我尝试调用一个像mydomain.org/index.php一样的页面,一切顺利,但是,当我尝试打开一个页面到用户的位置(mydomain /〜user / index.php)我有这个错误:“没有input文件指定“。 有办法解决这个问题吗?
我find了解决办法。 这个新的conf文件起作用。
worker_processes 2; error_log logs/error.log; pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 64; access_log logs/access.log; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 75 20; gzip on; gzip_comp_level 1; gzip_proxied any; gzip_min_length 1100; gzip_buffers 4 8k; gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; server { listen 80; server_name localhost; access_log logs/host.access.log; location / { root /var/www; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/www; } location ~* ^.+\.(jpg|jpeg|gif)$ { root /var/www; access_log off; expires 30d; } location ~ /\.ht { deny all; } location ~ ^/~(.+?)(/.*\.php)?$ { root /home/$1/public_html; include php_fastcgi.conf; fastcgi_param SCRIPT_FILENAME /home/$1/public_html$2; } location ~ ^/~(.+?)(/.*)?$ { alias /home/$1/public_html$2; index index.html index.htm; autoindex on; } location ~ \.php$ { root /var/www; include php_fastcgi.conf; fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name; } }
尝试从这里更新你的nginx.conf文件的以下部分:
location ~ \.php$ { root /var/www; include php_fastcgi.conf; fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name; }
对此:
location ~ \.php$ { root /var/www*; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/$fastcgi_script_name; include fastcgi_params; }
此外,请确保在进行更改后重新启动nginx。