Added nginx+mod_rewrite support

devel
alexey 7 hours ago
parent ae8b90d66e
commit f398decba9

@ -1,158 +1,224 @@
import { defineConfig } from 'vitepress';
import { version } from '../../package.json';
import { defineConfig } from "vitepress";
import { version } from "../../package.json";
export default defineConfig({
lang: 'en-US',
title: 'Hestia Control Panel',
description: 'Open-source web server control panel.',
lang: "en-US",
title: "Hestia Control Panel",
description: "Open-source web server control panel.",
lastUpdated: true,
cleanUrls: false,
lastUpdated: true,
cleanUrls: false,
head: [
['link', { rel: 'icon', sizes: 'any', href: '/favicon.ico' }],
['link', { rel: 'icon', type: 'image/svg+xml', sizes: '16x16', href: '/logo.svg' }],
['link', { rel: 'apple-touch-icon', sizes: '180x180', href: '/apple-touch-icon.png' }],
['link', { rel: 'manifest', href: '/site.webmanifest' }],
['meta', { name: 'theme-color', content: '#b7236a' }],
],
head: [
["link", { rel: "icon", sizes: "any", href: "/favicon.ico" }],
[
"link",
{ rel: "icon", type: "image/svg+xml", sizes: "16x16", href: "/logo.svg" },
],
[
"link",
{
rel: "apple-touch-icon",
sizes: "180x180",
href: "/apple-touch-icon.png",
},
],
["link", { rel: "manifest", href: "/site.webmanifest" }],
["meta", { name: "theme-color", content: "#b7236a" }],
],
themeConfig: {
logo: '/logo.svg',
themeConfig: {
logo: "/logo.svg",
nav: nav(),
nav: nav(),
socialLinks: [
{ icon: 'github', link: 'https://dev.brepo.ru/bayrepo/hestiacp' },
{ icon: 'github', link: 'https://github.com/bayrepo/hestiacp-rpm' },
{ icon: 'github', link: 'https://github.com/hestiacp/hestiacp' },
],
socialLinks: [
{ icon: "github", link: "https://dev.brepo.ru/bayrepo/hestiacp" },
{ icon: "github", link: "https://github.com/bayrepo/hestiacp-rpm" },
{ icon: "github", link: "https://github.com/hestiacp/hestiacp" },
],
sidebar: { '/docs/': sidebarDocs() },
sidebar: { "/docs/": sidebarDocs() },
outline: [2, 3],
outline: [2, 3],
footer: {
message: 'Выпущена под лицензией GPLv3.',
copyright: 'Copyright © 2019-present Hestia Control Panel и некоторые RPM based компоненты принадлежат bayrepo',
},
},
footer: {
message: "Выпущена под лицензией GPLv3.",
copyright:
"Copyright © 2019-present Hestia Control Panel и некоторые RPM based компоненты принадлежат bayrepo",
},
},
});
/** @returns {import("vitepress").DefaultTheme.NavItem[]} */
function nav() {
return [
{ text: 'Характеристики', link: '/features.md' },
{ text: 'Установка', link: '/install.md' },
{ text: 'Документация', link: '/docs/introduction/getting-started.md', activeMatch: '/docs/' },
{
text: `v${version}`,
items: [
{
text: 'Changelog',
link: 'https://dev.brepo.ru/bayrepo/hestiacp/src/branch/master/CHANGELOG.md',
},
{
text: 'Содействие в разработке',
link: 'https://dev.brepo.ru/bayrepo/hestiacp/src/branch/master/CONTRIBUTING.md',
},
{
text: 'Политика безопасности',
link: 'https://dev.brepo.ru/bayrepo/hestiacp/src/branch/master/SECURITY.md',
},
],
},
];
return [
{ text: "Характеристики", link: "/features.md" },
{ text: "Установка", link: "/install.md" },
{
text: "Документация",
link: "/docs/introduction/getting-started.md",
activeMatch: "/docs/",
},
{
text: `v${version}`,
items: [
{
text: "Changelog",
link: "https://dev.brepo.ru/bayrepo/hestiacp/src/branch/master/CHANGELOG.md",
},
{
text: "Содействие в разработке",
link: "https://dev.brepo.ru/bayrepo/hestiacp/src/branch/master/CONTRIBUTING.md",
},
{
text: "Политика безопасности",
link: "https://dev.brepo.ru/bayrepo/hestiacp/src/branch/master/SECURITY.md",
},
],
},
];
}
/** @returns {import("vitepress").DefaultTheme.SidebarItem[]} */
function sidebarDocs() {
return [
{
text: 'Знакомство',
collapsed: false,
items: [
{ text: 'С чего начать', link: '/docs/introduction/getting-started.md' },
{ text: 'Рекомендации', link: '/docs/introduction/best-practices.md' },
],
},
{
text: 'Инструкция пользователя',
collapsed: false,
items: [
{ text: 'Аккаунт', link: '/docs/user-guide/account.md' },
{ text: 'Резервные копии', link: '/docs/user-guide/backups.md' },
{ text: 'Cron задачи', link: '/docs/user-guide/cron-jobs.md' },
{ text: 'Базы данных', link: '/docs/user-guide/databases.md' },
{ text: 'DNS', link: '/docs/user-guide/dns.md' },
{ text: 'Менеджер файлов', link: '/docs/user-guide/file-manager.md' },
{ text: 'Почтовые домены', link: '/docs/user-guide/mail-domains.md' },
{ text: 'Оповещения', link: '/docs/user-guide/notifications.md' },
{ text: 'Пакеты', link: '/docs/user-guide/packages.md' },
{ text: 'Статистика', link: '/docs/user-guide/statistics.md' },
{ text: 'Пользователи', link: '/docs/user-guide/users.md' },
{ text: 'Веб домены', link: '/docs/user-guide/web-domains.md' },
],
},
{
text: 'Администрирование сервера',
collapsed: false,
items: [
{ text: 'Создание резервных копий и восстановление', link: '/docs/server-administration/backup-restore.md' },
{ text: 'Конфигурация', link: '/docs/server-administration/configuration.md' },
{ text: 'Персональная настройка', link: '/docs/server-administration/customisation.md' },
{ text: 'Базы данных и phpMyAdmin', link: '/docs/server-administration/databases.md' },
{ text: 'DNS кластера & DNSSEC', link: '/docs/server-administration/dns.md' },
{ text: 'Email', link: '/docs/server-administration/email.md' },
{ text: 'Менеджер файлов', link: '/docs/server-administration/file-manager.md' },
{ text: 'Firewall', link: '/docs/server-administration/firewall.md' },
{ text: 'Обновления ОС', link: '/docs/server-administration/os-upgrades.md' },
{ text: 'Rest API', link: '/docs/server-administration/rest-api.md' },
{ text: 'SSL сертификаты', link: '/docs/server-administration/ssl-certificates.md' },
{ text: 'Веб шаблоны и кэширование', link: '/docs/server-administration/web-templates.md' },
{ text: 'Troubleshooting', link: '/docs/server-administration/troubleshooting.md' },
],
},
{
text: 'Содейтсвие в разработке',
collapsed: false,
items: [
{ text: 'Сборка пакетов', link: '/docs/contributing/building.md' },
{ text: 'Разработка', link: '/docs/contributing/development.md' },
{ text: 'Документация', link: '/docs/contributing/documentation.md' },
{ text: 'Установка приложений', link: '/docs/contributing/quick-install-app.md' },
{ text: 'Тестирование', link: '/docs/contributing/testing.md' },
{ text: 'Переводы', link: '/docs/contributing/translations.md' },
],
},
{
text: 'Сообщество',
collapsed: false,
items: [
{ text: 'Hestia Nginx Cache', link: '/docs/community/hestia-nginx-cache.md' },
{
text: 'Ioncube installer for Hestia',
link: '/docs/community/ioncube-hestia-installer.md',
},
{ text: 'Генератор установочной команды', link: '/docs/community/install-script-generator.md' },
],
},
{
text: 'Ссылки',
collapsed: false,
items: [
{ text: 'API', link: '/docs/reference/api.md' },
{ text: 'CLI', link: '/docs/reference/cli.md' },
],
},
{
text: 'Дополнения',
collapsed: false,
items: [
{ text: 'PHP cli селектор', link: '/docs/extensions/php-cli-selector.md' },
{ text: 'Расширенные модули', link: '/docs/extensions/extended-modules.md' },
{ text: 'Настройка Local PHP', link: '/docs/extensions/local-php.md' },
],
},
];
return [
{
text: "Знакомство",
collapsed: false,
items: [
{
text: "С чего начать",
link: "/docs/introduction/getting-started.md",
},
{ text: "Рекомендации", link: "/docs/introduction/best-practices.md" },
],
},
{
text: "Инструкция пользователя",
collapsed: false,
items: [
{ text: "Аккаунт", link: "/docs/user-guide/account.md" },
{ text: "Резервные копии", link: "/docs/user-guide/backups.md" },
{ text: "Cron задачи", link: "/docs/user-guide/cron-jobs.md" },
{ text: "Базы данных", link: "/docs/user-guide/databases.md" },
{ text: "DNS", link: "/docs/user-guide/dns.md" },
{ text: "Менеджер файлов", link: "/docs/user-guide/file-manager.md" },
{ text: "Почтовые домены", link: "/docs/user-guide/mail-domains.md" },
{ text: "Оповещения", link: "/docs/user-guide/notifications.md" },
{ text: "Пакеты", link: "/docs/user-guide/packages.md" },
{ text: "Статистика", link: "/docs/user-guide/statistics.md" },
{ text: "Пользователи", link: "/docs/user-guide/users.md" },
{ text: "Веб домены", link: "/docs/user-guide/web-domains.md" },
],
},
{
text: "Администрирование сервера",
collapsed: false,
items: [
{
text: "Создание резервных копий и восстановление",
link: "/docs/server-administration/backup-restore.md",
},
{
text: "Конфигурация",
link: "/docs/server-administration/configuration.md",
},
{
text: "Персональная настройка",
link: "/docs/server-administration/customisation.md",
},
{
text: "Базы данных и phpMyAdmin",
link: "/docs/server-administration/databases.md",
},
{
text: "DNS кластера & DNSSEC",
link: "/docs/server-administration/dns.md",
},
{ text: "Email", link: "/docs/server-administration/email.md" },
{
text: "Менеджер файлов",
link: "/docs/server-administration/file-manager.md",
},
{ text: "Firewall", link: "/docs/server-administration/firewall.md" },
{
text: "Обновления ОС",
link: "/docs/server-administration/os-upgrades.md",
},
{ text: "Rest API", link: "/docs/server-administration/rest-api.md" },
{
text: "SSL сертификаты",
link: "/docs/server-administration/ssl-certificates.md",
},
{
text: "Веб шаблоны и кэширование",
link: "/docs/server-administration/web-templates.md",
},
{
text: "Troubleshooting",
link: "/docs/server-administration/troubleshooting.md",
},
],
},
{
text: "Содейтсвие в разработке",
collapsed: false,
items: [
{ text: "Сборка пакетов", link: "/docs/contributing/building.md" },
{ text: "Разработка", link: "/docs/contributing/development.md" },
{ text: "Документация", link: "/docs/contributing/documentation.md" },
{
text: "Установка приложений",
link: "/docs/contributing/quick-install-app.md",
},
{ text: "Тестирование", link: "/docs/contributing/testing.md" },
{ text: "Переводы", link: "/docs/contributing/translations.md" },
],
},
{
text: "Сообщество",
collapsed: false,
items: [
{
text: "Hestia Nginx Cache",
link: "/docs/community/hestia-nginx-cache.md",
},
{
text: "Ioncube installer for Hestia",
link: "/docs/community/ioncube-hestia-installer.md",
},
{
text: "Генератор установочной команды",
link: "/docs/community/install-script-generator.md",
},
],
},
{
text: "Ссылки",
collapsed: false,
items: [
{ text: "API", link: "/docs/reference/api.md" },
{ text: "CLI", link: "/docs/reference/cli.md" },
],
},
{
text: "Дополнения",
collapsed: false,
items: [
{
text: "PHP cli селектор",
link: "/docs/extensions/php-cli-selector.md",
},
{
text: "Расширенные модули",
link: "/docs/extensions/extended-modules.md",
},
{ text: "Настройка Local PHP", link: "/docs/extensions/local-php.md" },
{
text: "nginx+mod_rewrite",
link: "/docs/extensions/nginx-mod-rewrite.md",
},
],
},
];
}

@ -0,0 +1,15 @@
# nginx с поддержкой mdo_rewrite
HestiaCP RPM edition поддерживает установку приложений для доменов, таких как Wordpress, Joomla, Drupal и т.д.
Данные приложения написаны на PHP и требуют особого режима доступа к файлам, который реализуется с помощью .htaccess файла, в котором опианы эти правила преобразования URL.
Но .htaccess файл доступен только для Apache, для реализации работоспособнсти приложений в контрольной панели организованы шаблоны конфигурации nginx, которые по сути являются аналогами конфигурации из .htaccess.
Эти шаблоны размещены в каталоге `/usr/local/hestia/data/templates/web/nginx/php-fpm`.
# nginx + mod_rewrite
Но с версии 1.28.2 nginx добавлен экспериментальный модуль mod_rewrite для nginx, который позволяет понимать конфигурации из .htaccess и для nginx.
Для активации данной конфигурации, необходимо в настройках домена в `Расширенных настройках` выбрать в поле `Шаблон прокси` шаблон `nginx-php-rewrite`. Данный шаблон автоматически определит версию PHP-FPM для домена и активирует работу модуля mod_rewrite для nginx. Для данного домена Apache больше не будет принимать участие в обработке запроса, все будет обрабатываться в связке nginx-PHP-FPM.

@ -61,3 +61,4 @@
- [PHP cli селектор](/docs/extensions/php-cli-selector.md)
- [Расширенные модули](/docs/extensions/extended-modules.md)
- [Настройка Local PHP](/docs/extensions/local-php.md)
- [nginx + mod_rewrite](/docs/extensions/nginx-mod-rewrite.md)

@ -0,0 +1,67 @@
#=========================================================================#
# Default Web Domain Template #
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
# https://hestiacp.com/docs/server-administration/web-templates.html #
#=========================================================================#
server {
listen %ip%:%proxy_ssl_port% ssl;
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;
ssl_certificate %ssl_pem%;
ssl_certificate_key %ssl_key%;
ssl_stapling on;
ssl_stapling_verify on;
# TLS 1.3 0-RTT anti-replay
if ($anti_replay = 307) { return 307 https://$host$request_uri; }
if ($anti_replay = 425) { return 425; }
include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
HtaccessEnable on;
RewriteEngine On;
location ~ /\.(?!well-known\/) {
deny all;
return 404;
}
location / {
RewriteEngine On;
location ~* ^.+\.(jpeg|jpg|png|webp|gif|bmp|ico|svg|css|js)$ {
expires max;
fastcgi_hide_header "Set-Cookie";
}
location ~ [^/]\.php(/|$) {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
fastcgi_param HTTP_EARLY_DATA $rfc_early_data if_not_empty;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass %backend_lsnr%;
}
}
location /vstats/ {
alias %home%/%user%/web/%domain%/stats/;
include %home%/%user%/web/%domain%/stats/auth.conf*;
}
proxy_hide_header Upgrade;
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
}

@ -0,0 +1,54 @@
#=========================================================================#
# Default Web Domain Template #
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
# https://hestiacp.com/docs/server-administration/web-templates.html #
#=========================================================================#
server {
listen %ip%:%proxy_port%;
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;
include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
HtaccessEnable on;
RewriteEngine On;
location ~ /\.(?!well-known\/) {
deny all;
return 404;
}
location / {
RewriteEngine On;
location ~* ^.+\.(jpeg|jpg|png|webp|gif|bmp|ico|svg|css|js)$ {
expires max;
fastcgi_hide_header "Set-Cookie";
}
location ~ [^/]\.php(/|$) {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass %backend_lsnr%;
}
}
location /vstats/ {
alias %home%/%user%/web/%domain%/stats/;
include %home%/%user%/web/%domain%/stats/auth.conf*;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include %home%/%user%/conf/web/%domain%/nginx.conf_*;
}

@ -0,0 +1,64 @@
#=========================================================================#
# Default Web Domain Template #
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
# https://hestiacp.com/docs/server-administration/web-templates.html #
#=========================================================================#
server {
listen %ip%:%proxy_ssl_port% ssl;
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;
ssl_certificate %ssl_pem%;
ssl_certificate_key %ssl_key%;
ssl_stapling on;
ssl_stapling_verify on;
# TLS 1.3 0-RTT anti-replay
if ($anti_replay = 307) { return 307 https://$host$request_uri; }
if ($anti_replay = 425) { return 425; }
include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
location ~ /\.(?!well-known\/) {
deny all;
return 404;
}
location / {
try_files $uri $uri/ /index.php?$args;
location ~* ^.+\.(jpeg|jpg|png|webp|gif|bmp|ico|svg|css|js)$ {
expires max;
fastcgi_hide_header "Set-Cookie";
}
location ~ [^/]\.php(/|$) {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
fastcgi_param HTTP_EARLY_DATA $rfc_early_data if_not_empty;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass %backend_lsnr%;
}
}
location /vstats/ {
alias %home%/%user%/web/%domain%/stats/;
include %home%/%user%/web/%domain%/stats/auth.conf*;
}
proxy_hide_header Upgrade;
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
}

@ -0,0 +1,51 @@
#=========================================================================#
# Default Web Domain Template #
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
# https://hestiacp.com/docs/server-administration/web-templates.html #
#=========================================================================#
server {
listen %ip%:%proxy_port%;
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;
include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
location ~ /\.(?!well-known\/) {
deny all;
return 404;
}
location / {
try_files $uri $uri/ /index.php?$args;
location ~* ^.+\.(jpeg|jpg|png|webp|gif|bmp|ico|svg|css|js)$ {
expires max;
fastcgi_hide_header "Set-Cookie";
}
location ~ [^/]\.php(/|$) {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass %backend_lsnr%;
}
}
location /vstats/ {
alias %home%/%user%/web/%domain%/stats/;
include %home%/%user%/web/%domain%/stats/auth.conf*;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include %home%/%user%/conf/web/%domain%/nginx.conf_*;
}

@ -3,7 +3,7 @@
Name: hestia
Version: 1.9.6
Release: 3%{dist}
Release: 4%{dist}
Summary: Hestia Control Panel
Group: System Environment/Base
License: GPLv3
@ -184,6 +184,10 @@ fi
%{_tmpfilesdir}/%{name}.conf
%changelog
* Thu Mar 19 2026 Alexey Berezhok <a@bayrepo.ru> - 1.9.6-4
- Added nginx with mod_rewrite
- Added templates for nginx mod_rewrite activation
* Thu Jan 15 2026 Alexey Berezhok <a@bayrepo.ru> - 1.9.6-3
- Fix error on local php installation and extension activation

Loading…
Cancel
Save