Centos
無法讓 PHP 文件工作“找不到文件”
我在執行 CentOS 6.3 的 VPS 上安裝了 nginx,但我似乎無法讓任何 PHP 文件正常工作。
這是我的 nginx.conf 文件:-
user nginx; worker_processes 2; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; 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 /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on; include /etc/nginx/conf.d/*.conf; fastcgi_buffers 8 16k; fastcgi_buffer_size 32k; server_names_hash_bucket_size 128; server { server_name example.org www.example.org; listen 198.245.51.xxx; root /var/www/forum; index index.html index.htm index.php; access_log /var/log/virtualmin/example.org_access_log; error_log /var/log/virtualmin/example.org_error_log; include fastcgi_params; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx; 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 /var/www/forum/$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 /var/www/forum; 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; fastcgi_param HTTPS $https; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/forum/$fastcgi_script_name; fastcgi_param DOCUMENT_ROOT /var/www/forum; include /etc/nginx/fastcgi_params; } ssl_certificate /home/example/ssl.cert; ssl_certificate_key /home/example/ssl.key; fastcgi_read_timeout 60; autoindex on; } }
每當我嘗試打開 www.mydomain.com/index.php 或任何其他 php 文件時,我都會收到以下消息:-
http://i.imgur.com/eoy0ijT.png
提前致謝!請讓我知道我是否可以發布其他任何內容。
更改了 domain.conf 文件中的使用者和組,它又開始工作了。預設情況下,它設置為使用者:Apache 和組:Apache。
希望這可以幫助將來遇到同樣問題的人!謝謝大家的回答:)