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