nginx выступает фронтендом, панель управления FastPanel.
При подключении к PHP-FPM 8.3, сайт на друпал 10 запускается но ссылка https://xxx.ru/update.php, ведет на пустую страницу https://xxx.ru/update.php/selection, так-же не работает експорт конфигурации.
При подключении к FastCGI PHP 8.3 - выходит ошибка:
Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.2.0".
Сайт настроен на PHP 8.3, композер обновлен до последней версии - это значит подключается PHP 8.1 из окружения. В FastCGI смена PHP происходит через смену двоичного файла php-cgi или сокета php-fpm. Если этот путь не обновляется, сайт будет запускаться на старой версии PHP, что собственно и происходит, но как это исправить я уже 3 дня найти не могу, может кто сталкивался и есть какая-то хитрость. Права достаточные, конфиги уже все перепробовала, при том другой сайт на друпал 11 нормально работает именно в такой связке там, и копия сайта на друпал 10 прекрасно запускается и работает на обычном хостинге, только здесь не хочет.
Не корректно работает друпал с FastCGI или с PHP-FPM. Используется FastPanel на облачном сервере
Главные вкладки
Лучший ответ
Вообщем написала конфиг)) и добавила всяких полезностей, может кому-то пригодится, я имею ввиду по выдаче заголовков по новым требованиям для настройки сервера. При проверке сейчас вышло 44 балла из 50, что уже не плохо, с остальным еще разбираюсь.
Менеджер обновлений заработал, а для экспорта лимит добавила.
server_name xxx.ru;
listen xx.xxx.xx.xx:xxx ssl;
listen xx.xxx.xx.xx:xxx quic;
server_tokens off;
add_header X-XSS-Protection "1; mode=block" always;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
add_header X-XSS-Protection "1; mode=block; report=https://example.com/report" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "geolocation= 'none', microphone= 'none', camera= 'none'" always;
ssl_certificate /....................
http2 on;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
add_header Alt-Svc 'h3=":443"; ma=86400';
charset utf-8;
gzip on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/css text/xml application/javascript text/plain application/json image/svg+xml image/x-icon;
gzip_comp_level 5;
set $root_path /var/www/xxx_ru_usr/data/www/xxx.ru;
root $root_path;
disable_symlinks if_not_owner from=$root_path;
location / {
index index.php index.html;
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
try_files $fastcgi_script_name =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/xxx.ru.sock;
fastcgi_index index.php;
fastcgi_param HTTP_PROXY "";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_read_timeout 900s;
fastcgi_send_timeout 900s;
fastcgi_connect_timeout 900s;
}
location ~ ^(.+\.php)(/.+)$ {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
try_files $fastcgi_script_name =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/xxx.ru.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
# Для HTML-файлов с кэшированием на 1 день
location ~* \.(html|htm)$ {
add_header Cache-Control "public, max-age=86400" always;
}
# Для динамических файлов без кеша
location ~* \.(php|cgi|pl)$ {
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
}
# Для статических файлов с кэшированием на 30 дней
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpeg|avi|zip|gz|bz2|rar|swf|ico|7z|doc|docx|map|ogg|otf|pdf|tff|tif|txt|wav|webp|woff|woff2|xls|xlsx|xml|ico|svg|woff|woff2|ttf|eot)$ {
try_files $uri $uri/ /index.php?$args;
add_header Cache-Control "public, max-age=2592000, immutable" always;
if_modified_since exact;
expires max;
access_log off;
}
location ~* \.(?:css|js|gif|jpe?g|png|svg|ico|woff2?|ttf|eot|otf|webp|avif)$ {
try_files $uri =404;
expires max;
add_header Cache-Control "public, max-age=31536000, immutable" always;
access_log off;
log_not_found off;
}
location @fallback {
fastcgi_pass unix:/var/run/xxx.ru.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
include "/etc/nginx/fastpanel2-sites/xxx_ru_usr/xxx.ru.includes";
include /etc/nginx/fastpanel2-includes/*.conf;
error_log /var/www/xxx_ru_usr/data/logs/xxx.ru-frontend.error.log;
access_log /var/www/xxx_ru_usr/data/logs/xxx.ru-frontend.access.log;
}
Комментарии
"Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.2.0"" одно дело по какой версии работает сайт а другое по какой работает composer. проверьте php -v и исправьте на нужную версию.
чтобы исправить версию в командной строке я делал скрипты и подстановку до нужной версии. или настройте на хостинге если есть такая настройка.
с настройкой композера и сайта все норм, проверила, все обновлено и прекрасно работает на хостинге, но здесь это не решает проблему
php -v
PHP 8.4.12 (cli) (built: Aug 29 2025 06:47:47) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.4.12, Copyright (c) Zend Technologies
with Zend OPcache v8.4.12, Copyright (c), by Zend Technologies
так по меньшей мере версии пхп должны быть равны. на сайте и в командной строке.
да, я это уже тоже проверила, не помогло, раньше все было везде php 8.3, сейчас обновляю ищу решение но что-то на месте пока стою
Если у вас связка Ngnix + php-fpm, то в конфиги ngnix для вашего сайта укажите, какую версию php использовать. Это делается через "fastcgi_pass", пример:
location ~ '\.php$|^/update.php' {
...
fastcgi_pass unix:/var/run/php8.3-fpm.sock;
...
}
php8.3-fpm.sock - расположение файла и название у вас может отличаться. Посмотрите в конфигурации php-fpm параметр.
Конфигурация php-fpm обычно находится тут /etc/php/8.3/fpm/pool.d/www.conf
Благодарю за ответ - это я уже проверила, сайт в серверную ошибку падает, конфиги перезаписываются в фастпанели при смене настроек сайта, но я уже и с ручными настройками пробовала настроить и с перезаписанными самой панелью, пока на месте топчусь.
Сайт работает без менеджера обновлений, ставлю их через терминал, но хочется, чтобы все работало как положено.
Сегодня заметила странную вещь - перенесла еще один сайт и подключила в настройках так-же как этот PHP-FRM 8.3 и, этот имеющийся сайт упал.. отключила новый сайт, перестартовавала fp2-php83-fpm.service, проблемный сайт поднялся. Снова включила новый сайт, так-же упал этот...
Парадокс какой-то, думала что где-то порт и сокет сдублировался, но нет, все правильно в конфигах. Грешу уже на фастпанель, но так-как много работы проделано на сервере, менять ее не получится на что-то другое, ищу решение, знаю, что так быть не должно.
Так-же заметила, что фастпанель квадратные скобки подставляет, которые дают ошибку, но при этом, они скрыты для отображения в настройках, вообще случайно поняла, когда скинула вопрос в нейросеть, она мне их показала, что они там есть, если копировать из панели настройки. Зашла через терминал туда, проверила вроде нет, значит не в этом тоже дело. Впервые работаю с фастпанелью...
Конфиг у меня примерно такой сейчас:
server_name test.ru;
listen xx.xxx.xx.xx:443 ssl;
listen xx.xxx.xx.xx:443 quic;
ssl_certificate .........
http2 on;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
add_header Alt-Svc 'h3=":443"; ma=86400';
charset utf-8;
gzip on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/css text/xml application/javascript text/plain application/json image/svg+xml image/x-icon;
gzip_comp_level 5;
set $root_path /var/www/test_xx_usr/data/www/test.ru;
root $root_path;
disable_symlinks if_not_owner from=$root_path;
location / {
index index.php index.html;
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_read_timeout 600s;
fastcgi_send_timeout 600s;
fastcgi_connect_timeout 600s;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/test.ru.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpeg|avi|zip|gz|bz2|rar|swf|ico|7z|doc|docx|map|ogg|otf|pdf|tff|tif|txt|wav|webp|woff|woff2|xls|xlsx|xml)$ {
try_files $uri $uri/ /index.php?$args;
expires 1d;
}
location @fallback {
fastcgi_pass unix:/var/run/test.ru.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
include "/etc/nginx/fastpanel2-sites/test_xx_usr/test.ru.includes";
include /etc/nginx/fastpanel2-includes/*.conf;
error_log /var/www/test_xx_usr/data/logs/test.ru-frontend.error.log;
access_log /var/www/test_xx_usr/data/logs/test.ru-frontend.access.log;
}
server {
server_name test.ru;
listen xx.xxx.xx.xx:80;
return 301 https://$host$request_uri;
error_log /var/www/test_xx_usr/data/logs/test.ru-frontend.error.log;
access_log /var/www/test_xx_usr/data/logs/test.ru-frontend.access.log;
}
server {
server_name www.test.ru ;
....................
http2 on;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
add_header Alt-Svc 'h3=":443"; ma=86400';
return 301 $scheme://test.ru$request_uri;
error_log /var/www/test_xx_usr/data/logs/test.ru-frontend.error.log;
access_log /var/www/test_xx_usr/data/logs/test.ru-frontend.access.log;
}
С чем у вас связано не стандартное название сокета?
--> fastcgi_pass unix:/var/run/test.ru.sock;
У вас в папке домена есть папка "web"? Если да, то настройте, что бы ngnix в нее смотрел. Вот так:
--> set $root_path /var/www/test_xx_usr/data/www/test.ru/web;
Бывают сборки друпала, где содержимое в папке web, а вендорные библиотеки не в ней.
Когда перезапускаете процесс php-fpm, то потом перезапустите ngnix. Почему-то бывает, что ngnix потом не корректно подхватывает php-fpm процесс.
Добрый день!
У меня нет подкаталогов у сайтов, все размещены в своих корневых директориях и в там-же каталог vendor.
Про нестандартное название сокета, не поняла)) Наверное имела ввиду, что на двух сайтах, типа домене и поддомене мог создаться одинаковый путь unix:/var/run/xxx.ru.sock, но это не так, все правильно создалось.
Про папку web имел ввиду вот такую структуру каталогов в папке сайта - скриншот. Если у вас так же, то ngnix нужно указать смотреть в папку web.
"...Про нестандартное название сокета, не поняла..."
Тут мне сложно понять, я с FastPanel не работал. Но там общий принцип для сайтов. В конфигурации ngnix, адрес сокета должен быть такой же, как в конфигурации php-fpm.
Ниже пример конфигурации ngnix, он базовый под разные версии друпала. На основе этой конфигурации несколько сайтов работают, проблем нет.
В вашем случае меня смущает такая строка: index.php?$args;
В ней вы передаете get параметры из URL, а не саму URL.
listen 80;
server_name photoeditor.ru;
root /var/www/photoeditor.ru/web;
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;
}
location ~ ^/sites/.*/private/ {
return 403;
}
# Block access to scripts in site files directory
location ~ ^/sites/[^/]+/files/.*\.php$ {
deny all;
}
# Allow "Well-Known URIs" as per RFC 5785
location ~* ^/.well-known/ {
allow all;
}
# 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; # For Drupal <= 6
try_files $uri /index.php?$query_string; # For Drupal >= 7
}
location @rewrite {
#rewrite ^/(.*)$ /index.php?q=$1; # For Drupal <= 6
rewrite ^ /index.php; # For Drupal >= 7
}
# Don't allow direct access to PHP files in the vendor directory.
location ~ /vendor/.*\.php$ {
deny all;
return 404;
}
# Protect files and directories from prying eyes.
location ~* \.(engine|inc|install|make|module|profile|po|sh|.*sql|theme|twig|tpl(\.php)?|xtmpl|yml)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock)|web\.config)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig|\.save)$ {
deny all;
return 404;
}
# In Drupal 8, we must also match new paths where the '.php' appears in
# the middle, such as update.php/selection. The rule we use is strict,
# and only allows this pattern with the update.php front controller.
# This allows legacy path aliases in the form of
# blog/index.php/legacy-path to continue to route to Drupal nodes. If
# you do not have any paths like that, then you might prefer to use a
# laxer rule, such as:
# location ~ \.php(/|$) {
# The laxer rule will continue to work if Drupal uses this new URL
# pattern with front controllers other than update.php in a future
# release.
location ~ '\.php$|^/update.php' {
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
# Ensure the php file exists. Mitigates CVE-2019-11043
try_files $fastcgi_script_name =404;
# Security note: If you're running a version of PHP older than the
# latest 5.3, you should have "cgi.fix_pathinfo = 0;" in php.ini.
# See http://serverfault.com/q/627903/94922 for details.
include fastcgi_params;
# Block httpoxy attacks. See https://httpoxy.org/.
fastcgi_param HTTP_PROXY "";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param QUERY_STRING $query_string;
fastcgi_intercept_errors on;
# PHP 5 socket location.
#fastcgi_pass unix:/var/run/php5-fpm.sock;
# PHP 8 socket location.
fastcgi_pass php81:9000;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
try_files $uri @rewrite;
expires max;
log_not_found off;
}
# Fighting with Styles? This little gem is amazing.
# location ~ ^/sites/.*/files/imagecache/ { # For Drupal <= 6
location ~ ^/sites/.*/files/styles/ { # For Drupal >= 7
try_files $uri @rewrite;
}
# Handle private files through Drupal. Private file's path can come
# with a language prefix.
location ~ ^(/[a-z\-]+)?/system/files/ { # For Drupal >= 7
try_files $uri /index.php?$query_string;
}
# Enforce clean URLs
# Removes index.php from urls like www.example.com/index.php/my-page --> www.example.com/my-page
# Could be done with 301 for permanent or other redirect codes.
if ($request_uri ~* "^(.*/)index\.php/(.*)") {
return 307 $1$2;
}
}
Вообщем написала конфиг)) и добавила всяких полезностей, может кому-то пригодится, я имею ввиду по выдаче заголовков по новым требованиям для настройки сервера. При проверке сейчас вышло 44 балла из 50, что уже не плохо, с остальным еще разбираюсь.
Менеджер обновлений заработал, а для экспорта лимит добавила.
server_name xxx.ru;
listen xx.xxx.xx.xx:xxx ssl;
listen xx.xxx.xx.xx:xxx quic;
server_tokens off;
add_header X-XSS-Protection "1; mode=block" always;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
add_header X-XSS-Protection "1; mode=block; report=https://example.com/report" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "geolocation= 'none', microphone= 'none', camera= 'none'" always;
ssl_certificate /....................
http2 on;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
add_header Alt-Svc 'h3=":443"; ma=86400';
charset utf-8;
gzip on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/css text/xml application/javascript text/plain application/json image/svg+xml image/x-icon;
gzip_comp_level 5;
set $root_path /var/www/xxx_ru_usr/data/www/xxx.ru;
root $root_path;
disable_symlinks if_not_owner from=$root_path;
location / {
index index.php index.html;
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
try_files $fastcgi_script_name =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/xxx.ru.sock;
fastcgi_index index.php;
fastcgi_param HTTP_PROXY "";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_read_timeout 900s;
fastcgi_send_timeout 900s;
fastcgi_connect_timeout 900s;
}
location ~ ^(.+\.php)(/.+)$ {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
try_files $fastcgi_script_name =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/xxx.ru.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
# Для HTML-файлов с кэшированием на 1 день
location ~* \.(html|htm)$ {
add_header Cache-Control "public, max-age=86400" always;
}
# Для динамических файлов без кеша
location ~* \.(php|cgi|pl)$ {
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
}
# Для статических файлов с кэшированием на 30 дней
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpeg|avi|zip|gz|bz2|rar|swf|ico|7z|doc|docx|map|ogg|otf|pdf|tff|tif|txt|wav|webp|woff|woff2|xls|xlsx|xml|ico|svg|woff|woff2|ttf|eot)$ {
try_files $uri $uri/ /index.php?$args;
add_header Cache-Control "public, max-age=2592000, immutable" always;
if_modified_since exact;
expires max;
access_log off;
}
location ~* \.(?:css|js|gif|jpe?g|png|svg|ico|woff2?|ttf|eot|otf|webp|avif)$ {
try_files $uri =404;
expires max;
add_header Cache-Control "public, max-age=31536000, immutable" always;
access_log off;
log_not_found off;
}
location @fallback {
fastcgi_pass unix:/var/run/xxx.ru.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
include "/etc/nginx/fastpanel2-sites/xxx_ru_usr/xxx.ru.includes";
include /etc/nginx/fastpanel2-includes/*.conf;
error_log /var/www/xxx_ru_usr/data/logs/xxx.ru-frontend.error.log;
access_log /var/www/xxx_ru_usr/data/logs/xxx.ru-frontend.access.log;
}
Что за баллы? Кто их считает?
На итсофт баллы считают)) - но у них немного устарели требования к проверке, есть то, что уже иначе работает.
Можно самостоятельно проверить что сервер в ответах отправляет
curl -I https://xxx.ru