84 lines
2.5 KiB
Plaintext
84 lines
2.5 KiB
Plaintext
# upstream goaccess_backend {
|
|
# server goaccess:7890;
|
|
#
|
|
# # Keep up to 32 idle connections per worker
|
|
# keepalive 16;
|
|
#
|
|
# # Maximum time a connection can be idle
|
|
# keepalive_timeout 60s;
|
|
#
|
|
# # Maximum requests per keepalive connection
|
|
# keepalive_requests 100;
|
|
# }
|
|
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name goaccess.novicelab.io;
|
|
|
|
# ACME challenge for Let's Encrypt certificate renewal
|
|
location /.well-known/acme-challenge/ {
|
|
root /var/www/certbot;
|
|
}
|
|
|
|
location / {
|
|
return 301 https://$server_name$request_uri;
|
|
}
|
|
}
|
|
|
|
map $http_upgrade $connection_upgrade {
|
|
default upgrade;
|
|
'' close;
|
|
}
|
|
|
|
# Server block for GoAccess dashboard
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
http2 on;
|
|
server_name goaccess.novicelab.io;
|
|
|
|
# SSL
|
|
ssl_certificate /etc/letsencrypt/live/novicelab.io/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/novicelab.io/privkey.pem;
|
|
ssl_trusted_certificate /etc/letsencrypt/live/novicelab.io/chain.pem;
|
|
|
|
# Security Headers
|
|
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
|
|
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 "strict-origin-when-cross-origin" always;
|
|
add_header Content-Security-Policy "default-src 'self' https: data: 'unsafe-inline' 'unsafe-eval';" always;
|
|
add_header Permissions-Policy "interest-cohort=()" always;
|
|
|
|
# Logging
|
|
access_log /var/log/nginx/goaccess.novicelab.io_access.log json_combined;
|
|
error_log /var/log/nginx/goaccess.novicelab.io_error.log debug;
|
|
|
|
set $goaccess_backend goaccess:7890;
|
|
|
|
root /usr/share/nginx/html;
|
|
index report.html;
|
|
|
|
location / {
|
|
try_files $uri $uri/ =404;
|
|
}
|
|
|
|
location /ws {
|
|
proxy_pass http://$goaccess_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-Scheme $scheme;
|
|
proxy_set_header X-Forwarded-Proto $scheme; #https;
|
|
proxy_set_header X-Forwarded-Host $http_host;
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
|
|
|
#enable ws upgrade
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "Upgrade";
|
|
}
|
|
} |