Прошу по возможности помочь. Связка: phpbb 3.3 + nginx + php-fpm + VestaCP. Есть два шаблона весты:
1.stpl:
Код: Выделить всё
server {
listen %ip%:%web_ssl_port% http2;
server_name %domain_idn% %alias_idn%;
root %docroot%;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/%domain%.log combined;
access_log /var/log/nginx/domains/%domain%.bytes bytes;
error_log /var/log/nginx/domains/%domain%.error.log error;
if ($host != "%domain%") {
return 301 https://%domain%$request_uri;
}
ssl on;
ssl_certificate %ssl_pem%;
ssl_certificate_key %ssl_key%;
location / {
# phpBB uses index.htm
index index.php index.html index.htm;
try_files $uri $uri/ @rewriteapp;
}
location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}
# Deny access to internal phpbb files.
location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb|store|vendor) {
deny all;
# deny was ignored before 0.8.40 for connections over IPv6.
# Use internal directive to prohibit access on older versions.
internal;
return 404;
}
# Pass the php scripts to fastcgi server specified in upstream declaration.
location ~ \.php(/|$) {
# Unmodified fastcgi_params from nginx distribution.
include fastcgi_params;
# Necessary for php.
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
try_files $uri $uri/ /app.php$is_args$args;
fastcgi_index index.php;
fastcgi_pass %backend_lsnr%; # - должно быть то же самое, что и в секции location / дефолтного шаблона
}
# Correctly pass scripts for installer
location /install/ {
# phpBB uses index.htm
try_files $uri $uri/ @rewrite_installapp;
# Pass the php scripts to fastcgi server specified in upstream declaration.
location ~ \.php(/|$) {
# Unmodified fastcgi_params from nginx distribution.
include fastcgi_params;
# Necessary for php.
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
try_files $uri $uri/ /install/app.php$is_args$args;
fastcgi_pass %backend_lsnr%; # - должно быть то же самое, что и в секции location / дефолтного шаблона
}
}
location @rewrite_installapp {
rewrite ^(.*)$ /install/app.php/$1 last;
}
# Deny access to version control system directories.
location ~ /\.svn|/\.git {
deny all;
internal;
}
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%/%user%/web/%domain%/document_errors/;
}
location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}
location /vstats/ {
alias %home%/%user%/web/%domain%/stats/;
# include %home%/%user%/conf/web/%domain%.auth
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;
include %home%/%user%/conf/web/nginx.%domain_idn%.conf*;
}
и 2.stpl:
Код: Выделить всё
server {
listen %ip%:%web_ssl_port% http2;
server_name %domain_idn% %alias_idn%;
root %sdocroot%;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/%domain%.log combined;
access_log /var/log/nginx/domains/%domain%.bytes bytes;
error_log /var/log/nginx/domains/%domain%.error.log error;
if ($host != "%domain%") {
return 301 https://%domain%$request_uri;
}
ssl on;
ssl_certificate %ssl_pem%;
ssl_certificate_key %ssl_key%;
location / {
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
try_files $uri $uri/ /app.php$is_args$args;
# if (!-f $document_root$fastcgi_script_name) {
# return 404;
#}
fastcgi_pass %backend_lsnr%;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}
include %home%/%user%/conf/web/snginx.%domain%.conf*;
}
C 1.stpl нормально работает URL-rewriting, но главная страница форума открывается только с приставкой «index.php» (иначе открывается интерфейс phpbb и информация, что запрашиваемая страница не найдена). С шаблоном 2.stpl rewriting не работает, но зато главная страница открывается как с index.php, так и без него.
Желаемый результат: чтобы был и URL-rewriting, и главную можно было открыть без index.php. Ну и чтобы решение было как можно менее костыльным)
Полагаю, дело в каком-то незначительном куске кода в шаблоне 1.stpl, но сам не могу допереть.
Адрес форума: forum.aidazanami.ru.
Заранее благодарен за потраченное время!