Files
ksef-pdf-generator/nginx-ksef.conf

64 lines
1.9 KiB
Plaintext

# Konfiguracja nginx dla aplikacji KSEF PDF Generator
# Umieść ten blok w konfigu nginx w sekcji http lub server
server {
listen 80;
server_name www.sic.pl;
# Ścieżka do zbudowanej aplikacji
root /home/ms/projekty/fv-ksef-nodejs/ksef-pdf-generator/dist-app;
# Kompresja
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
gzip_min_length 1000;
# Lokacja /ksef/
location /ksef/ {
# Alias do dist-app
alias /home/ms/projekty/fv-ksef-nodejs/ksef-pdf-generator/dist-app/;
# Obsługa SPA: spróbuj plik, jeśli nie istnieje spróbuj index.html
try_files $uri $uri/ /ksef/index.html;
# Buforowanie: index.html bez cache
location = /ksef/index.html {
add_header Cache-Control "public, max-age=0, must-revalidate";
add_header X-Content-Type-Options "nosniff";
}
# Buforowanie: statyczne assety z cache
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
add_header Cache-Control "public, max-age=31536000, immutable";
}
}
# Zabezpieczenia
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
# Logi
access_log /var/log/nginx/ksef-access.log;
error_log /var/log/nginx/ksef-error.log;
}
# HTTPS (opcjonalne, wymaga certyfikatu)
# server {
# listen 443 ssl http2;
# server_name www.sic.pl;
#
# ssl_certificate /path/to/cert.pem;
# ssl_certificate_key /path/to/key.pem;
#
# # ... reszta konfigu jak wyżej
# }
#
# # Redirect HTTP -> HTTPS
# server {
# listen 80;
# server_name www.sic.pl;
# return 301 https://$server_name$request_uri;
# }