Настроил сервер FastCGI (NGINX + PHP-FPM) с панелью управления ISPManager 5 lite.
После редактирования конфига Nginx загружается главная страница и контент по ссылкам верхнего меню, однако при переходе в товар выдается ошибка 404.
Конфгиг получился такой:
server {
server_name ***.ru www.***.ru;
charset UTF-8;
index index.html;
disable_symlinks if_not_owner from=$root_path;
include /etc/nginx/vhosts-includes/*.conf;
include /etc/nginx/vhosts-resources/***.ru/*.conf;
access_log /var/www/httpd-logs/***.ru.access.log;
error_log /var/www/httpd-logs/***.ru.error.log notice;
set $root_path /var/www/***/data/www/***.ru;
root $root_path;
# Сжатие
gzip on;
gzip_comp_level 8;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_disable "msie6";
gzip_types text/plain application/xml application/javascript text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss image/svg+xml;
# Прочие настройки
client_max_body_size 100m;
client_body_buffer_size 128k;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
client_header_buffer_size 1k;
large_client_header_buffers 4 16k;
location / {
# Главный скрипт
index index.php index.html index.htm;
# Для работы API
rewrite ^/api/(.*)$ /api.php?_d=$1&ajax_custom=1&$args last;
# Логика поиска скрипта по порядку: файл, папка, скрипт
try_files $uri $uri/ @fallback;
location ~ [^/]\.ph(p\d*|tml)$ {
try_files /does_not_exists @php;
}
}
# Правило rewrite для модуля SEO
location @fallback {
rewrite ^(.*)$ /index.php?$args last;
}
location @php {
fastcgi_index index.php;
fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f webmaster@shopsan.ru";
fastcgi_pass unix:/var/www/php-fpm/***.sock;
fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
try_files $uri =404;
include fastcgi_params;
}
# Настройки статики, первое правило
location ~* \.(jpeg|ico|jpg|gif|png|css|js|pdf|txt|tar|gz|wof|csv|zip|xml|yml) {
access_log off;
# Правило поиска статических файлов. Если файл не находится по адресу магазина, то ищем файл по правилу @statics.
# Например если магазин расположен в подпапке ***.ru/shop/
try_files $uri =404;
expires 14d;
add_header Access-Control-Allow-Origin *;
add_header Cache-Control public;
root $root_path;
location ~ [^/]\.ph(p\d*|tml)$ {
try_files /does_not_exists @php;
}
}
Правило поиска статических файлов для витрин. Например, если у Вас две витрины в разных подпапках: ***.ru и ***.ru/shop/
location @statics {
rewrite ^/(\w+)/(.*)$ /$2 break;
access_log off;
rewrite_log off;
expires 14d;
add_header Cache-Control public;
add_header Access-Control-Allow-Origin *;
root $root_path;
}
location ~ \.php$ {
fastcgi_index index.php;
fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f webmaster@***.ru";
fastcgi_pass unix:/var/www/php-fpm/***.sock;
fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
try_files $uri =404;
include fastcgi_params;
location ~ [^/]\.ph(p\d*|tml)$ {
try_files /does_not_exists @php;
}
}
add_header Strict-Transport-Security "max-age=31536000;";
listen ***;
}
server {
server_name ***.ru www.***.ru;
charset UTF-8;
index index.html;
disable_symlinks if_not_owner from=$root_path;
include /etc/nginx/vhosts-includes/*.conf;
include /etc/nginx/vhosts-resources/***.ru/*.conf;
access_log /var/www/httpd-logs/***.ru.access.log;
error_log /var/www/httpd-logs/***.ru.error.log notice;
set $root_path /var/www/***/data/www/***.ru;
root $root_path;
# Сжатие
gzip on;
gzip_comp_level 8;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_disable "msie6";
gzip_types text/plain application/xml application/javascript text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss image/svg+xml;
# Прочие настройки
client_max_body_size 100m;
client_body_buffer_size 128k;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
client_header_buffer_size 1k;
large_client_header_buffers 4 16k;
location / {
# Главный скрипт
index index.php index.html index.htm;
# Для работы API
rewrite ^/api/(.*)$ /api.php?_d=$1&ajax_custom=1&$args last;
# Логика поиска скрипта по порядку: файл, папка, скрипт
try_files $uri $uri/ @fallback;
location ~ [^/]\.ph(p\d*|tml)$ {
try_files /does_not_exists @php;
}
}
# Правило rewrite для модуля SEO
location @fallback {
rewrite ^(.*)$ /index.php?$args last;
}
location @php {
fastcgi_index index.php;
fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f webmaster@***.ru";
fastcgi_pass unix:/var/www/php-fpm/***.sock;
fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
try_files $uri =404;
include fastcgi_params;
}
# Настройки статики, первое правило
location ~* \.(jpeg|ico|jpg|gif|png|css|js|pdf|txt|tar|gz|wof|csv|zip|xml|yml) {
access_log off;
# Правило поиска статических файлов. Если файл не находится по адресу магазина, то ищем файл по правилу @statics.
# Например если магазин расположен в подпапке ***.ru/shop/
try_files $uri =404;
expires 14d;
add_header Access-Control-Allow-Origin *;
add_header Cache-Control public;
root $root_path;
location ~ [^/]\.ph(p\d*|tml)$ {
try_files /does_not_exists @php;
}
}
Правило поиска статических файлов для витрин. Например, если у Вас две витрины в разных подпапках: ***.ru и ***.ru/shop/
location @statics {
rewrite ^/(\w+)/(.*)$ /$2 break;
access_log off;
rewrite_log off;
expires 14d;
add_header Cache-Control public;
add_header Access-Control-Allow-Origin *;
root $root_path;
}
location ~ \.php$ {
fastcgi_index index.php;
fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f webmaster@***.ru";
fastcgi_pass unix:/var/www/php-fpm/kyborg.sock;
fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
try_files $uri =404;
include fastcgi_params;
location ~ [^/]\.ph(p\d*|tml)$ {
try_files /does_not_exists @php;
}
}
add_header Strict-Transport-Security "max-age=31536000;";
listen ***;
ssl on;
ssl_certificate "/var/www/httpd-cert/***/***.ru_le1.crtca";
ssl_certificate_key "/var/www/httpd-cert/***/***.ru_le1.key";
ssl_ciphers EECDH:***;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_dhparam /etc/ssl/certs/dhparam4096.pem;
}
Куда копать?, я так понимаю проблема в rewrite?