Vesta 2.0 is coming soon! See our progress update: https://vestacp.com/docs/vesta-2-update
Проблема с отображением картинок для Drupal 7 под nginx + php-fpm
Проблема с отображением картинок для Drupal 7 под nginx + php-fpm
Добрый день.
Решил на тестовом VPS поставить новую "Весту" и выбрал в качестве сервера nginx + php-fpm.
Установил там тестовый сайт на Drupal 7.
И в процессе столкнулся со следующей проблемой:
По умолчанию "чистые ссылки" не работают, надо раскомментировать кое-что в nginx.
Ну а когда включаешь эти "чистые ссылки", то на странице перестают отображаться изображения.
Никто с таким не сталкивался ?
Мой тестовый сайт - r-yakimkin.ru
P.S. Если картинка без стиля, то есть, её адрес = http://....image.jpg, то она отображается.
А если в картинке присутствует image.jpg?itok=... , то возникают проблемы с отображением
Вот текст nginx.conf
Решил на тестовом VPS поставить новую "Весту" и выбрал в качестве сервера nginx + php-fpm.
Установил там тестовый сайт на Drupal 7.
И в процессе столкнулся со следующей проблемой:
По умолчанию "чистые ссылки" не работают, надо раскомментировать кое-что в nginx.
Ну а когда включаешь эти "чистые ссылки", то на странице перестают отображаться изображения.
Никто с таким не сталкивался ?
Мой тестовый сайт - r-yakimkin.ru
P.S. Если картинка без стиля, то есть, её адрес = http://....image.jpg, то она отображается.
А если в картинке присутствует image.jpg?itok=... , то возникают проблемы с отображением
Вот текст nginx.conf
Code: Select all
server {
listen 185.69.54.228:80;
server_name 12946.s.time4vps.eu www.12946.s.time4vps.eu;
root /home/admin/web/12946.s.time4vps.eu/public_html;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/12946.s.time4vps.eu.log combined;
access_log /var/log/nginx/domains/12946.s.time4vps.eu.bytes bytes;
error_log /var/log/nginx/domains/12946.s.time4vps.eu.error.log error;
location / {
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
rewrite ^(.*)$ /index.php?q=$1 last;
}
}
error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;
location /error/ {
alias /home/admin/web/12946.s.time4vps.eu/document_errors/;
}
location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;
include /home/admin/conf/web/nginx.12946.s.time4vps.eu.conf*;
}
server {
listen 185.69.54.228:80;
server_name r-yakimkin.ru www.r-yakimkin.ru;
root /home/admin/web/r-yakimkin.ru/public_html;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/r-yakimkin.ru.log combined;
access_log /var/log/nginx/domains/r-yakimkin.ru.bytes bytes;
error_log /var/log/nginx/domains/r-yakimkin.ru.error.log error;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Very rarely should these ever be accessed outside of your lan
location ~* \.(txt|log)$ {
allow 192.168.0.0/16;
deny all;
}
location ~ \..*/.*\.php$ {
return 403;
}
# No no for private
location ~ ^/sites/.*/private/ {
return 403;
}
# Block access to "hidden" files and directories whose names begin with a
# period. This includes directories used by version control systems such
# as Subversion or Git to store control files.
location ~ (^|/)\. {
return 403;
}
location / {
try_files $uri @rewrite;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass 127.0.0.1:9002;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_intercept_errors on;
include /etc/nginx/fastcgi_params;
}
}
location @rewrite {
# You have 2 options here
# For D7 and above:
# Clean URLs are handled in drupal_environment_initialize().
rewrite ^ /index.php;
# For Drupal 6 and bwlow:
# Some modules enforce no slash (/) at the end of the URL
# Else this rewrite block wouldn't be needed (GlobalRedirect)
# rewrite ^/(.*)$ /index.php?q=$1;
}
location ~ ^/sites/.*/files/styles/ {
try_files $uri @rewrite;
}
error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;
location /error/ {
alias /home/admin/web/r-yakimkin.ru/document_errors/;
}
location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;
include /home/admin/conf/web/nginx.r-yakimkin.ru.conf*;
}
Re: Проблема с отображением картинок для Drupal 7 под nginx + php-fpm
Помнишь решение проблемы?)