История изменений
Исправление Mooks, (текущая версия) :
Опечатался я малость, строка при попытку установки выглядит так:
/forum/install/app.php/install
Отдельный конфиг для Joomla выглядит так из рекомендаций самой Joomla:
server {
listen 80;
include snippets/phpmyadmin.conf;
server_name site.ru;
server_name_in_redirect off;
access_log /var/log/nginx/localhost.access_log;
error_log /var/log/nginx/localhost.error_log info;
root /var/www/html;
index index.php index.html index.htm default.html default.htm;
}
# Support API
location /api/ {
try_files $uri $uri/ /api/index.php?$args;
}
# Support Clean (aka Search Engine Friendly) URLs
location / {
try_files $uri $uri/ /index.php?$args;
}
# add global x-content-type-options header
add_header X-Content-Type-Options nosniff;
# deny running scripts inside writable directories
location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
return 403;
error_page 403 /403_error.html;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi.conf;
}
# caching of files
location ~* \.(ico|pdf|flv)$ {
expires 1y;
}
location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
expires 14d;
}
}
Для Phpbb:
# Board configuration.
server {
listen 80;
server_name site.ru;
root /var/www/html/community;
index index.php index.html index.htm default.html default.htm;
# phpBB uses index.htm
index index.php index.html index.htm;
# Loggers
error_log /var/log/nginx/site.ru.error.log warn;
access_log /var/log/nginx/site.ru.access.log;
location / {
try_files $uri $uri/ @rewriteapp;
# Pass the php scripts to FastCGI server specified in upstream declaration.
location ~ \.php(/|$) {
include fastcgi.conf;
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_pass unix:/run/php/php8.2-fpm.sock;
}
# Deny access to internal phpbb files.
location ~ /(config|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb(?!\w+)|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;
}
}
location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}
# Correctly pass scripts for installer
location /install/ {
try_files $uri $uri/ @rewrite_installapp =404;
# Pass the php scripts to fastcgi server specified in upstream declaration.
location ~ \.php(/|$) {
include fastcgi.conf;
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 =404;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
}
}
location @rewrite_installapp {
rewrite ^(.*)$ /install/app.php/$1 last;
}
# Deny access to version control system directories.
location ~ /\.svn|/\.git {
deny all;
internal;
}
}
Использую комбинированный конфиг:
server {
listen 80;
# Основные настройки
server_name site.ru;
server_name_in_redirect off;
root /var/www/html;
index index.php index.html index.htm default.html default.htm;
# Логи
access_log /var/log/nginx/site.ru.access.log;
error_log /var/log/nginx/site.ru.error.log warn;
# Joomla (корень)
location / {
try_files $uri $uri/ /index.php?$args;
}
# Поддержка API Joomla
location /api/ {
try_files $uri $uri/ /api/index.php?$args;
}
# Защита от выполнения PHP в директориях с пользовательскими данными
location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
return 403;
error_page 403 /403_error.html;
}
# phpBB (каталог /community)
location /community/ {
root /var/www/html;
index index.php index.html index.htm;
# Основная обработка
try_files $uri $uri/ @rewrite_forum;
# Обработка PHP-файлов
location ~ ^/community/.*\.php$ {
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
}
# Защита от доступа к конфигурационным и системным файлам
location ~ ^/community/(config|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb(?!\w+)|store|vendor) {
deny all;
}
}
location @rewrite_forum {
rewrite ^/community/(.*)$ /community/app.php/$1 last;
}
# Общая обработка PHP
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
}
# Кэширование статических файлов
location ~* \.(ico|pdf|flv)$ {
expires 1y;
}
location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
expires 14d;
}
# Защита от доступа к скрытым файлам и системным папкам
location ~ /\.(ht|svn|git) {
deny all;
}
# HTTP-заголовок для безопасности
add_header X-Content-Type-Options nosniff;
}
При этом перейдя в каталог community, страница приветствия скрипта открывается так:
site.ru/forum/install/app.php
Но при нажатии кнопки установить перекидывает на:
site.ru/forum/install/app.php/install
И выдаёт страницу ошибки 404 от корневого скрипта.
Исходная версия Mooks, :
Опечатался я малость, строка при попытку установки выглядит так:
/forum/install/app.php//install
Отдельный конфиг для Joomla выглядит так из рекомендаций самой Joomla:
server {
listen 80;
include snippets/phpmyadmin.conf;
server_name site.ru;
server_name_in_redirect off;
access_log /var/log/nginx/localhost.access_log;
error_log /var/log/nginx/localhost.error_log info;
root /var/www/html;
index index.php index.html index.htm default.html default.htm;
}
# Support API
location /api/ {
try_files $uri $uri/ /api/index.php?$args;
}
# Support Clean (aka Search Engine Friendly) URLs
location / {
try_files $uri $uri/ /index.php?$args;
}
# add global x-content-type-options header
add_header X-Content-Type-Options nosniff;
# deny running scripts inside writable directories
location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
return 403;
error_page 403 /403_error.html;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi.conf;
}
# caching of files
location ~* \.(ico|pdf|flv)$ {
expires 1y;
}
location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
expires 14d;
}
}
Для Phpbb:
# Board configuration.
server {
listen 80;
server_name site.ru;
root /var/www/html/community;
index index.php index.html index.htm default.html default.htm;
# phpBB uses index.htm
index index.php index.html index.htm;
# Loggers
error_log /var/log/nginx/site.ru.error.log warn;
access_log /var/log/nginx/site.ru.access.log;
location / {
try_files $uri $uri/ @rewriteapp;
# Pass the php scripts to FastCGI server specified in upstream declaration.
location ~ \.php(/|$) {
include fastcgi.conf;
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_pass unix:/run/php/php8.2-fpm.sock;
}
# Deny access to internal phpbb files.
location ~ /(config|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb(?!\w+)|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;
}
}
location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}
# Correctly pass scripts for installer
location /install/ {
try_files $uri $uri/ @rewrite_installapp =404;
# Pass the php scripts to fastcgi server specified in upstream declaration.
location ~ \.php(/|$) {
include fastcgi.conf;
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 =404;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
}
}
location @rewrite_installapp {
rewrite ^(.*)$ /install/app.php/$1 last;
}
# Deny access to version control system directories.
location ~ /\.svn|/\.git {
deny all;
internal;
}
}
Использую комбинированный конфиг:
server {
listen 80;
# Основные настройки
server_name site.ru;
server_name_in_redirect off;
root /var/www/html;
index index.php index.html index.htm default.html default.htm;
# Логи
access_log /var/log/nginx/site.ru.access.log;
error_log /var/log/nginx/site.ru.error.log warn;
# Joomla (корень)
location / {
try_files $uri $uri/ /index.php?$args;
}
# Поддержка API Joomla
location /api/ {
try_files $uri $uri/ /api/index.php?$args;
}
# Защита от выполнения PHP в директориях с пользовательскими данными
location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
return 403;
error_page 403 /403_error.html;
}
# phpBB (каталог /community)
location /community/ {
root /var/www/html;
index index.php index.html index.htm;
# Основная обработка
try_files $uri $uri/ @rewrite_forum;
# Обработка PHP-файлов
location ~ ^/community/.*\.php$ {
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
}
# Защита от доступа к конфигурационным и системным файлам
location ~ ^/community/(config|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb(?!\w+)|store|vendor) {
deny all;
}
}
location @rewrite_forum {
rewrite ^/community/(.*)$ /community/app.php/$1 last;
}
# Общая обработка PHP
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
}
# Кэширование статических файлов
location ~* \.(ico|pdf|flv)$ {
expires 1y;
}
location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
expires 14d;
}
# Защита от доступа к скрытым файлам и системным папкам
location ~ /\.(ht|svn|git) {
deny all;
}
# HTTP-заголовок для безопасности
add_header X-Content-Type-Options nosniff;
}
При этом перейдя в каталог community, страница приветствия скрипта открывается так:
site.ru/forum/install/app.php
Но при нажатии кнопки установить перекидывает на:
site.ru/forum/install/app.php/install
И выдаёт страницу ошибки 404 от корневого скрипта.