Answer the question
In order to leave comments, you need to log in
Joomla (+Phoca Gallery) + nginx + php-fpm: Problem generating images?
rivet!
There is a problem:
When generating thumbnails for Phoca Gallery, the script generates a couple of pictures and that's it - a white screen, nothing happens. Only restart of nginx server helps.
My nginx configs:
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/tmp/wwwpool.sock;
fastcgi_cache one;
fastcgi_cache_min_uses 3;
fastcgi_cache_valid 200 301 302 304 5m;
fastcgi_cache_key "$request_method|$host|$request_uri";
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_ignore_client_abort off;
}
index index.html index.php;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~ /\.ht {
deny all;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
return 403;
error_page 403 /403_error.html;
}
# caching of files
location ~* \.(ico|pdf|flv)$ {
expires 1y;
}
location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
expires 14d;
}
user user;
worker_processes 1;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
http {
fastcgi_cache_path /tmp/fcgi-cache/ levels=1:2 keys_zone=one:10m;
sendfile on;
sendfile_max_chunk 128k;
postpone_output 1460;
server_names_hash_bucket_size 64;
client_max_body_size 15m;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
proxy_read_timeout 120;
proxy_connect_timeout 120;
server_tokens off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
ssi on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
Answer the question
In order to leave comments, you need to log in
fastcgi_cache_key:
carefully working with dependencies
fastcgi_cache_key "$request_method|$http_if_modified_since|$http_if_none_match|$host|$request_uri";
The value in the directive deserves special attention fastcgi_cache_key
. I gave the minimum working value of this directive. Step to the right, step to the left, and in some cases you will start getting "wrong" data from the cache. So:
We need a dependency on $request_method, because HEAD requests on the Internet are quite frequent. The response to a HEAD request never contains a body. If you remove the dependency on $request_method, then it may coincide that someone before you requested the main page using the HEAD method, and then you will be given empty content via GET.
The dependency on $http_if_modified_since
is needed so that the cache with a 304 Not Modified response is not accidentally returned to a client making a normal GET request. Otherwise, the client may receive an empty response from the cache.
Same thing with$http_if_none_match
. We must be insured against issuing blank pages to customers!
dependence on $host и $request_uri
does not require comments
Source: http://dklab.ru/chicken/nablas/56.html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question