server {
	root /var/www/front/public/;
	server_name cojedzie.localhost;

    location /api/ {
        root /var/www/api/public/;
        try_files $uri $uri/ index.php$is_args$args;
    }

    location /_profiler/ {
        root /var/www/api/public/;
        try_files $uri $uri/ index.php$is_args$args;
    }

    location /bundles/ {
        root /var/www/api/public/;
        try_files $uri $uri/;
    }

    location / {
        try_files $uri $uri/ @frontend;
    }

    location @frontend {
        proxy_pass http://frontend:3000;
        proxy_intercept_errors on;
    }

    location ~ (.+).php(/|$) {
        root /var/www/api/public/;

        fastcgi_pass api:9000;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;

        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME /var/www/public/$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT /var/www/public/;

        fastcgi_param APP_ENV "dev";
        fastcgi_param DATABASE_URL "sqlite:///%kernel.project_dir%/var/app.db";

        internal;
    }
}
