Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

nginx sends 404 instead of waiting for fastcgi

$
0
0
Hey all!

Our nginx is configured to send thumbnails from a folder. If they don't exist, nginx has to pass the request to fastcgi to generate the thumbnail and send it to the user.

If the requested doesn't exist, nginx sends a 404 to the user instead of waiting for fastcgi to generate the thumbnail. But: it sends a request to fastcgi! ~ 200 ms after the 404, the thumbnail exists and is delivered from the static folder.

How can I configure nginx to wait for the response?

Thanks a lot

Kind regards
Ueli

---- Configuration



upstream production_fcgi {
server unix:/var/run/application-production.sock;
}

server {
listen 443;

ssl on;
ssl_certificate /etc/nginx/ssl/example.com.crt;
ssl_certificate_key /etc/nginx/ssl/example.com.key;

server_name example.com
www.example.com;

root /var/www/production/current/web/;

location ~ ^/cache {
try_files $uri @rewriteapp;
}


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

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

location ~ ^/(app|app_dev|config)\.php(/|$) {
fastcgi_pass production_fcgi;
fastcgi_split_path_info ^(.+\.php)(/.*)$;

include fastcgi_params;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
}
}

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>