Answer the question
In order to leave comments, you need to log in
Nginx + Apache. Why doesn't imagick work?
The nginx + apache + mod_php bundle does not work image processing with ImageMagick, and the GD extension does not work either. Any graphic file is normally loaded and displayed, but if processing by means of GD or ImageMagick is applied to it, then nothing happens. Neither PHP nor both servers have errors (except for file access errors that should have appeared after processing the original image)
If you remove nginx, then with one apache, image processing in any way (either GD or imagick) works fine.
I just recently started to get acquainted with nginx and I ask you to tell me in which direction I should dig this problem.
Configs:
nginx.conf
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nodelay on;
keepalive_timeout 65;
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_proxied any;
gzip_comp_level 4;
gzip_buffers 4 8k;
gzip_http_version 1.0;
gzip_min_length 1100;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
server {
listen 80;
server_name example.com www.example.com;
access_log /var/www/logs/nginx_access.log;
error_log /var/www/logs/nginx_error.log;
location ~*
\.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|tar|wav|bmp|rtf|swf|ico|flv|txt|docx|xlsx)$ {
root /var/www/srv/marques1/www/sitera;
index index.html index.php;
access_log off;
expires 30d;
}
location ~ /\.ht {
deny all;
}
location / {
proxy_pass http://127.0.0.1:8376/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-for $remote_addr;
proxy_set_header Host $host;
proxy_connect_timeout 60;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_redirect off;
proxy_set_header Connection close;
proxy_pass_header Content-Type;
proxy_pass_header Content-Disposition;
proxy_pass_header Content-Length;
}
}
Answer the question
In order to leave comments, you need to log in
location ~*
\.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|tar|wav|bmp|rtf|swf|ico|flv|txt|docx|xlsx)$ {
root /var/www/srv/marques1/www/sitera;
try_files $uri @resize
access_log off;
expires 30d;
}
location @resize {
proxy_pass http://127.0.0.1:8376;
}
nginx acts as a proxy server and does not interact directly with imagemagick. If everything works on apache, then it should work on nginx.
The fact that nothing happens is also strange, there should be at least some error message.
See php logs.
Error at the very beginning
location ~*\.(jpg
Change to
location ~* ^.+\.
(
jpg
present
the
url
site.ru/prajs http://$host:8376;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
Everything that nginx did not find will be useful to take from Apache.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question