change nginx.conf

This commit is contained in:
F4ilji
2026-01-22 13:27:18 +05:00
parent b976814d8b
commit 8104d0b6cd
+28 -19
View File
@@ -18,6 +18,7 @@ server {
listen 443 ssl http2; listen 443 ssl http2;
server_name www.ntspi.ru; server_name www.ntspi.ru;
# SSL-конфигурация
ssl_certificate /etc/letsencrypt/live/www.ntspi.ru/fullchain.pem; ssl_certificate /etc/letsencrypt/live/www.ntspi.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.ntspi.ru/privkey.pem; ssl_certificate_key /etc/letsencrypt/live/www.ntspi.ru/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/www.ntspi.ru/chain.pem; ssl_trusted_certificate /etc/letsencrypt/live/www.ntspi.ru/chain.pem;
@@ -32,6 +33,7 @@ server {
resolver 8.8.8.8 8.8.4.4 valid=300s; resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 5s; resolver_timeout 5s;
# Сжатие
gzip on; gzip on;
gzip_disable "msie6"; gzip_disable "msie6";
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;
@@ -46,36 +48,36 @@ server {
root /var/www/public; root /var/www/public;
# Security headers
add_header X-Frame-Options "SAMEORIGIN"; add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff"; add_header X-Content-Type-Options "nosniff";
add_header X-XSS-Protection "1; mode=block"; add_header X-XSS-Protection "1; mode=block";
add_header Referrer-Policy "strict-origin-when-cross-origin"; add_header Referrer-Policy "strict-origin-when-cross-origin";
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"; add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
location ~ ^/(upload|storage|images|docs|files)/.*\.php$ { # Основной вход в приложение
deny all;
return 404;
}
location ~ ^/storage/app/public/upload/iblock/.*\.php$ {
deny all;
return 404;
}
location ~ ^/vendor/.*\.php$ {
deny all;
return 404;
}
location ~ /\.(?!well-known).* {
deny all;
}
location / { location / {
add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Origin *;
try_files $uri /index.php?$args; try_files $uri /index.php?$args;
} }
# =========================================================================
# Настройки для VIKON CORE (Исправление ошибки 404)
# =========================================================================
location ^~ /vikon_core/ {
root /var/www/public;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass app:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS On;
}
}
# Статические разделы SVEDEN и ABITUR
location /sveden/ { location /sveden/ {
alias /var/www/public/sveden/; alias /var/www/public/sveden/;
index index.html; index index.html;
@@ -100,6 +102,7 @@ server {
return 301 /abitur/; return 301 /abitur/;
} }
# Общий обработчик PHP для остального сайта
location ~ \.php$ { location ~ \.php$ {
try_files $uri =404; try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_split_path_info ^(.+\.php)(/.+)$;
@@ -114,6 +117,12 @@ server {
fastcgi_param HTTPS On; fastcgi_param HTTPS On;
} }
# Запрет доступа к скрытым файлам
location ~ /\.(?!well-known).* {
deny all;
}
# Блок для обновления Let's Encrypt
location ^~ /.well-known/acme-challenge/ { location ^~ /.well-known/acme-challenge/ {
root /var/www/certbot; root /var/www/certbot;
allow all; allow all;