Symfony2 app in subdirectory nginx

Posted by Frido on Server Fault See other posts from Server Fault or by Frido
Published on 2011-11-24T15:35:23Z Indexed on 2011/11/30 10:02 UTC
Read the original article Hit count: 790

Filed under:
|
|
|

I'm trying to setup a symfony2 app in a subdirectory of our Server

Webserver: nginx 1.1.6 + php fpm OS: gentoo

my target is to get the app working from a subdirectory

subdomain.xy.domain.tld/tool

my nginx config looks like that

server  {

    listen          80;
    server_name     subdomain.xy.domain.tld;

    error_log       /var/log/nginx/subdomain.xy.error.log info;
    access_log      /var/log/nginx/subdomain.xy.access.log main;


    location /tool {

        root /var/www/vhosts/subdomain.xy/tool/web;

        index app.php;

        location ~ \.php($|/) {
            include fastcgi_params;

            set $script $uri;
            set $path_info "";

            if ($uri ~ "^(.+\.php)($|/)") {
                set $script $1;
            }

            if ($uri ~ "^(.+\.php)(/.+)") {
                set $script $1;
                set $path_info $2;
            }

            fastcgi_param SCRIPT_FILENAME /var/www/vhosts/subdomain.xy/tool/web$fastcgi_script_name;
            #fastcgi_intercept_errors on;
            fastcgi_pass 127.0.0.1:9000;

            fastcgi_param SCRIPT_NAME $script;
            fastcgi_param PATH_INFO $path_info;
        }
    }

}

I have really no clue how to do this... I've searched the web for hours and tried dozens of different configs but nothing worked. I hope someone has an idea =)

© Server Fault or respective owner

Related posts about php

Related posts about nginx