Я делаю сайт с контактной формой и хочу использовать PHP. Веб-сайт размещен на моем простом локальном сервере с использованием NGINX. Я знаю, что NGINX использует FastCGI и PHP-FPM, но, будучи новичком в этом, я не уверен, как настроить все, чтобы все это работало. Вот что у меня в файле 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/