|
| 1 | +# Robust maxun nginx config file |
| 2 | +# DO NOT uncomment commented lines unless YOU know what they mean and YOU know what YOU are doing! |
| 3 | +### HTTP server block ### |
| 4 | +server { |
| 5 | + server_name maxun.my.domain; |
| 6 | + root /usr/share/nginx/html; |
| 7 | + listen 80; |
| 8 | + server_tokens off; |
| 9 | + return 301 https://$server_name$request_uri; |
| 10 | +} |
| 11 | +### HTTPS server block ### |
| 12 | +server { |
| 13 | +### Default config ### |
| 14 | + server_name maxun.my.domain; |
| 15 | + root /usr/share/nginx/html; |
| 16 | + access_log /var/log/nginx/maxun_access.log; |
| 17 | + error_log /var/log/nginx/maxun_error.log info; |
| 18 | + listen 443 ssl; |
| 19 | + http2 on; |
| 20 | + server_tokens off; |
| 21 | +### SSL config ### |
| 22 | + ssl_certificate /etc/letsencrypt/live/my.domain/fullchain.pem; |
| 23 | + ssl_certificate_key /etc/letsencrypt/live/my.domain/privkey.pem; |
| 24 | + ssl_trusted_certificate /etc/letsencrypt/live/my.domain/chain.pem; |
| 25 | + ssl_protocols TLSv1.2 TLSv1.3; |
| 26 | + #ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1:secp384r1; |
| 27 | + ssl_ecdh_curve X25519:prime256v1:secp384r1; |
| 28 | + ssl_prefer_server_ciphers off; |
| 29 | + ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305; |
| 30 | + ssl_stapling off; |
| 31 | + ssl_stapling_verify off; |
| 32 | + ssl_session_cache shared:MozSSL:10m; |
| 33 | + ssl_session_tickets off; |
| 34 | + ssl_session_timeout 1d; |
| 35 | + ssl_dhparam dh.pem; |
| 36 | + #ssl_conf_command Options KTLS; |
| 37 | +### Performance tuning config ### |
| 38 | + client_max_body_size 512M; |
| 39 | + client_body_timeout 300s; |
| 40 | + client_body_buffer_size 256k; |
| 41 | + #pagespeed off; |
| 42 | +### Compression ### |
| 43 | + ## gzip ## |
| 44 | + gzip on; |
| 45 | + gzip_vary on; |
| 46 | + gzip_comp_level 5; |
| 47 | + gzip_min_length 256; |
| 48 | + gzip_disable msie6; |
| 49 | + gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; |
| 50 | + gzip_buffers 16 8k; |
| 51 | + gzip_types application/atom+xml text/javascript application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; |
| 52 | + ## brotli: enable only if you have compiled nginx with brotli support!!! ## |
| 53 | + #brotli on; |
| 54 | + #brotli_static on; |
| 55 | + #brotli_comp_level 6; |
| 56 | + #brotli_types application/atom+xml application/javascript application/json application/rss+xml |
| 57 | + # application/vnd.ms-fontobject application/x-font-opentype application/x-font-truetype |
| 58 | + # application/x-font-ttf application/x-javascript application/xhtml+xml application/xml |
| 59 | + # font/eot font/opentype font/otf font/truetype image/svg+xml image/vnd.microsoft.icon |
| 60 | + # image/x-icon image/x-win-bitmap text/css text/javascript text/plain text/xml; |
| 61 | +### Default headers ### |
| 62 | + add_header Referrer-Policy "no-referrer" always; |
| 63 | + add_header X-Content-Type-Options "nosniff" always; |
| 64 | + add_header X-Frame-Options "SAMEORIGIN" always; |
| 65 | + add_header X-Permitted-Cross-Domain-Policies "none" always; |
| 66 | + add_header X-Robots-Tag "noindex, nofollow" always; |
| 67 | + add_header X-XSS-Protection "1; mode=block" always; |
| 68 | + add_header Permissions-Policy "geolocation=(self), midi=(self), sync-xhr=(self), microphone=(self), camera=(self), magnetometer=(self), gyroscope=(self), fullscreen=(self), payment=(self), interest-cohort=()"; |
| 69 | +### Proxy rules ### |
| 70 | + # Backend web traffic and websockets |
| 71 | + location ~ ^/(auth|storage|record|workflow|robot|proxy|api-docs|api|webhook|socket.io)(/|$) { |
| 72 | + proxy_pass http://localhost:8080; #Change the port number to match .env file BACKEND_PORT variable |
| 73 | + proxy_http_version 1.1; |
| 74 | + proxy_set_header Upgrade $http_upgrade; |
| 75 | + proxy_set_header Connection 'upgrade'; |
| 76 | + proxy_set_header Host $host; |
| 77 | + proxy_set_header X-Real-IP $remote_addr; |
| 78 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 79 | + proxy_set_header X-Forwarded-Proto $scheme; |
| 80 | + } |
| 81 | + # Frontend web traffic |
| 82 | + location / { |
| 83 | + proxy_pass http://localhost:5173; #Change the port number to match .env file FRONTEND_PORT variable |
| 84 | + proxy_http_version 1.1; |
| 85 | + proxy_set_header Upgrade $http_upgrade; |
| 86 | + proxy_set_header Connection 'upgrade'; |
| 87 | + proxy_set_header Host $host; |
| 88 | + proxy_set_header X-Real-IP $remote_addr; |
| 89 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 90 | + proxy_set_header X-Forwarded-Proto $scheme; |
| 91 | + } |
| 92 | +} |
0 commit comments