我正在build立一个联系表格的网站,我想用PHP。 该网站使用NGINX在我简单的本地服务器上托pipe。 我知道NGINX使用FastCGI和PHP-FPM,但是对于这一点来说,我并不确定如何configuration所有的东西来使其工作。 这是我在我的nginx.conf文件中:
server { listen 7070; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root /Users/vibhusharma/Sites/JCA; access_log "/Users/vibhusharma/Sites/JCA/jca_access.log"; error_log "/Users/vibhusharma/Sites/JCA/jca_errors.log"; index index.html index.htm; try_files $uri $uri/ /index.html =404; #fastcgi_split_path_info ^(.+\.php)(/.+)$; #fastcgi_pass 127.0.0.1:9000; #fastcgi_index index.php; #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #fastcgi_buffers 256 128k; #fastcgi_connect_timeout 300s; fastcgi_send_timeout 300s; #fastcgi_read_timeout 300s; #include fastcgi_params; } #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 html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; include fastcgi_params; }
还有什么我需要做的,让我的服务器来解释我的PHP文件? 谢谢!
你有没有启用PHP? 显然这在OS-X中默认没有完成。 这或者可能没有安装。
http://jason.pureconcepts.net/2012/10/install-apache-php-mysql-mac-os-x/