Initial commit
This commit is contained in:
+79
@@ -0,0 +1,79 @@
|
||||
# /etc/nginx/sites-available/it-ticket-system
|
||||
# Symlink to sites-enabled:
|
||||
# sudo ln -s /etc/nginx/sites-available/it-ticket-system /etc/nginx/sites-enabled/
|
||||
|
||||
upstream it_ticket_app {
|
||||
server 127.0.0.1:5000 fail_timeout=0;
|
||||
}
|
||||
|
||||
# Redirect HTTP → HTTPS
|
||||
server {
|
||||
listen 80;
|
||||
server_name tickets.yourdomain.com;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
server_name tickets.yourdomain.com;
|
||||
|
||||
# ── SSL Certificates (Let's Encrypt / certbot) ──────────────────────────
|
||||
ssl_certificate /etc/letsencrypt/live/tickets.yourdomain.com/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/tickets.yourdomain.com/privkey.pem;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_timeout 10m;
|
||||
|
||||
# ── Security Headers ────────────────────────────────────────────────────
|
||||
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
|
||||
add_header X-Frame-Options SAMEORIGIN;
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin";
|
||||
|
||||
# ── Logging ─────────────────────────────────────────────────────────────
|
||||
access_log /var/log/nginx/it_tickets_access.log;
|
||||
error_log /var/log/nginx/it_tickets_error.log warn;
|
||||
|
||||
# ── Client limits ───────────────────────────────────────────────────────
|
||||
client_max_body_size 20M;
|
||||
|
||||
# ── Static files (served directly by nginx) ─────────────────────────────
|
||||
location /static/ {
|
||||
alias /var/www/it-ticket-system/app/static/;
|
||||
expires 7d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
access_log off;
|
||||
}
|
||||
|
||||
# ── WebSocket (Socket.IO) ───────────────────────────────────────────────
|
||||
location /socket.io/ {
|
||||
proxy_pass http://it_ticket_app;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
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 86400;
|
||||
}
|
||||
|
||||
# ── Application ─────────────────────────────────────────────────────────
|
||||
location / {
|
||||
proxy_pass http://it_ticket_app;
|
||||
proxy_redirect off;
|
||||
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_connect_timeout 60s;
|
||||
proxy_send_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
proxy_buffering on;
|
||||
proxy_buffer_size 8k;
|
||||
proxy_buffers 8 8k;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user