刚刚在我的Mac上酿造了nginx和php-fpm(10.9)。我使用了本教程:http://rtcamp.com/tutorials/mac/osx-brew-php-mysql-nginx/
所以但是当我在ngix conf中建立我的第一个"服务器"博客时,php文件总是会被下载,我在谷歌上找不到任何解决方案。
这是我的共识:
http {
include /usr/local/etc/nginx/sites-enabled/pma.dev.conf;
include /usr/local/Sites/localsites.conf;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 8080;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
server_name pma.dev;
listen pma.dev:9090;
location / {
root /usr/local/share/phpmyadmin;
index index.php;
}
location ~ '.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+'.php)(/.+)$;
fastcgi_index index.php;
include fastcgi_params;
}
}
}
你需要
一个fastcgi_pass
指令来告诉nginx你的FPM服务器在哪里运行。例如。 fastcgi_pass 127.0.0.1:9000;
是否在端口 9000 上运行它。