astro-admin/nginx.conf

84 lines
2.3 KiB
Nginx Configuration File

server {
listen 80;
server_name admin.astromayak.ru;
root /usr/share/nginx/html;
index index.html;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# ACME challenge — serve files directly, no SPA fallback
location /.well-known/acme-challenge/ {
try_files $uri =404;
}
# Admin API proxy
location /admin/api/ {
resolver 127.0.0.11 valid=30s;
set $backend "astro-bot:18793";
proxy_pass http://$backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_read_timeout 300s;
client_max_body_size 10m;
}
# SPA fallback
location / {
try_files $uri $uri/ /index.html;
}
# No cache for index.html
location = /index.html {
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
}
server {
listen 80;
server_name pay.astromayak.ru;
root /usr/share/nginx/html;
index index.html;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
# ACME challenge
location /.well-known/acme-challenge/ {
try_files $uri =404;
}
# Payment API + YooKassa webhook
location /admin/api/ {
resolver 127.0.0.11 valid=30s;
set $backend "astro-bot:18793";
proxy_pass http://$backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 60s;
}
# Public thank-you page after payment (see dist/status.html)
location /status {
try_files /status.html =404;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
location / {
try_files $uri $uri/ /index.html;
}
location = /index.html {
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
}