symfony 2的Nginx配置

时间:2015-12-21 20:51:44

标签: php symfony nginx

我想配置我的symfony 2应用程序,以便省略所有/web/app.php,除非那是/web/app_dev.php,然后我想进入开发环境。

问题是我总是得到502错误的网关错误。怎么了?

这是我目前的配置:

server {

    listen 80;

    # Server name being used (exact name, wildcards or regular expression)
    server_name domain.com;
    client_max_body_size 20M;

    # Document root, make sure this points to your Symfony2 /web directory
    root /var/www/domain.com/web;

    rewrite ^/app\.php/?(.*)$ /$1 permanent;

    # Logging
    error_log  /var/log/nginx/domain.com.error.log;
    access_log /var/log/nginx/domain.com.access.log;

    location / {
        index app.php;
        try_files $uri @rewriteapp;
    }

    location @rewriteapp {
        rewrite ^(.*)$ /app.php/$1 last;
    }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ ^/(app|app_dev)\.php(/|$) {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi.conf;
        fastcgi_index index.php;
    }
}

0 个答案:

没有答案