BastionGuard/data/vhosts/nginx.conf
specialworld83 d34e319fbe Public release
2026-02-27 21:37:06 +01:00

84 lines
2.7 KiB
Nginx Configuration File

# ==========================================================
# BastionGuard Local Warning Server (Nginx Reverse Proxy)
# ==========================================================
server {
listen 127.0.0.2:80 default_server;
server_name warning.BastionGuard.local;
# --- Proxy HTTP verso server locale (porta 81) ---
location / {
proxy_pass http://127.0.0.2:81/;
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;
# Fallback se il backend non risponde
error_page 502 503 504 /block.html;
}
# --- Directory fallback per la pagina di blocco ---
location = /block.html {
root /usr/share/BastionGuard/data/blocking;
default_type text/html;
}
# --- Headers di sicurezza ---
add_header X-Frame-Options "DENY" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer" always;
# --- Logging ---
access_log /var/log/BastionGuard/BastionGuard_http_access.log;
error_log /var/log/BastionGuard/BastionGuard_http_error.log warn;
}
# ==========================================================
# BastionGuard Local Warning Server (Nginx HTTPS Reverse Proxy)
# ==========================================================
server {
listen 127.0.0.2:443 ssl default_server;
server_name warning.BastionGuard.local;
# --- SSL configuration ---
ssl_certificate /etc/BastionGuard/certs/local-warning.crt.pem;
ssl_certificate_key /etc/BastionGuard/certs/local-warning.key.pem;
# 🔧 Certificati self-signed locali
ssl_verify_client off;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
# --- Proxy HTTPS verso server locale BastionGuard (porta 444) ---
location / {
proxy_pass https://127.0.0.2:444/;
proxy_ssl_verify off;
proxy_ssl_server_name on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
error_page 502 503 504 /block.html;
}
# --- Directory fallback ---
location = /block.html {
root /usr/share/BastionGuard/data/blocking;
default_type text/html;
}
# --- Headers di sicurezza ---
add_header X-Frame-Options "DENY" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer" always;
# --- Logging ---
access_log /var/log/BastionGuard/BastionGuard_https_access.log;
error_log /var/log/BastionGuard/BastionGuard_https_error.log warn;
}