mac上的nginx不会运行php

时间:2013-11-12 19:46:05

标签: nginx php

刚刚在我的mac(10.9)上酿造了nginx和php-fpm。我用过这个教程: http://rtcamp.com/tutorials/mac/osx-brew-php-mysql-nginx/

所以但是当我在ngix conf中设置我的第一个“服务器”-blog时,php文件总是会被下载,我在google上找不到任何解决方案。

这是我的conf:

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;
        } 
    }
}

1 个答案:

答案 0 :(得分:0)

您需要fastcgi_pass指令来告诉nginx您的FPM服务器正在运行的位置。例如。 fastcgi_pass 127.0.0.1:9000;如果您在端口9000上运行它。