2019-03-14 14:00:34 +00:00
|
|
|
# default nginx site config for Mobilizon
|
|
|
|
#
|
|
|
|
# Simple installation instructions:
|
|
|
|
# 1. Install your TLS certificate, possibly using Let's Encrypt.
|
|
|
|
# 2. Replace 'example.tld' with your instance's domain wherever it appears.
|
|
|
|
# 3. Copy this file to /etc/nginx/sites-available/ and then add a symlink to it
|
|
|
|
# in /etc/nginx/sites-enabled/ and run 'nginx -s reload' or restart nginx.
|
|
|
|
|
|
|
|
server {
|
|
|
|
server_name example.tld;
|
|
|
|
|
|
|
|
listen 80;
|
|
|
|
listen [::]:80;
|
2020-06-16 08:57:11 +00:00
|
|
|
|
|
|
|
# Remove once HTTPS is setup
|
|
|
|
location ^~ '/.well-known/acme-challenge' {
|
|
|
|
root /var/www/certbot;
|
|
|
|
default_type "text/plain";
|
|
|
|
}
|
|
|
|
|
|
|
|
# Uncomment once HTTPS is setup
|
|
|
|
# return 301 https://$server_name$request_uri;
|
2019-03-14 14:00:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
server_name example.tld;
|
|
|
|
|
|
|
|
listen 443 ssl http2;
|
|
|
|
listen [::]:443 ssl http2;
|
|
|
|
ssl_session_timeout 5m;
|
|
|
|
|
2020-06-16 08:57:11 +00:00
|
|
|
# Uncomment once you get the certificates
|
|
|
|
# ssl_trusted_certificate /etc/letsencrypt/live/example.tld/fullchain.pem;
|
|
|
|
# ssl_certificate /etc/letsencrypt/live/example.tld/fullchain.pem;
|
|
|
|
# ssl_certificate_key /etc/letsencrypt/live/example.tld/privkey.pem;
|
2019-03-14 14:00:34 +00:00
|
|
|
|
|
|
|
# Add TLSv1.3 if it's supported by your system
|
2020-10-09 10:17:33 +00:00
|
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
2019-03-14 14:00:34 +00:00
|
|
|
ssl_ciphers 'EECDH+aRSA+AESGCM:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:+CAMELLIA256:+AES256:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!ECDSA';
|
|
|
|
ssl_prefer_server_ciphers on;
|
|
|
|
ssl_ecdh_curve prime256v1;
|
|
|
|
# ssl_ecdh_curve X25519:prime256v1:secp384r1:secp521r1;
|
|
|
|
ssl_stapling on;
|
|
|
|
ssl_stapling_verify on;
|
2020-10-09 10:17:33 +00:00
|
|
|
add_header Strict-Transport-Security "max-age=31536000";
|
2019-03-14 14:00:34 +00:00
|
|
|
|
2019-10-11 15:03:18 +00:00
|
|
|
gzip on;
|
|
|
|
gzip_disable "msie6";
|
2019-03-14 14:00:34 +00:00
|
|
|
gzip_vary on;
|
|
|
|
gzip_proxied any;
|
|
|
|
gzip_comp_level 6;
|
|
|
|
gzip_buffers 16 8k;
|
|
|
|
gzip_http_version 1.1;
|
|
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/activity+json application/atom+xml;
|
|
|
|
|
|
|
|
# the nginx default is 1m, not enough for large media uploads
|
|
|
|
client_max_body_size 16m;
|
|
|
|
|
2020-10-09 10:17:33 +00:00
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
proxy_set_header Host $http_host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
2020-10-09 15:06:17 +00:00
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2021-04-13 09:35:19 +00:00
|
|
|
|
2020-10-09 10:17:33 +00:00
|
|
|
|
|
|
|
location / {
|
2023-12-04 07:18:45 +00:00
|
|
|
expires off;
|
|
|
|
add_header Cache-Control "public, max-age=0, s-maxage=0, must-revalidate" always;
|
2020-10-09 15:06:17 +00:00
|
|
|
proxy_pass http://localhost:4000;
|
2020-10-09 10:17:33 +00:00
|
|
|
}
|
|
|
|
|
2020-06-16 08:57:11 +00:00
|
|
|
# Let's Encrypt keeps its files here
|
|
|
|
location ^~ '/.well-known/acme-challenge' {
|
|
|
|
root /var/www/certbot;
|
|
|
|
default_type "text/plain";
|
|
|
|
}
|
|
|
|
|
2023-12-04 07:18:45 +00:00
|
|
|
location ~ ^/(assets|img) {
|
2022-01-19 20:47:34 +00:00
|
|
|
root /opt/mobilizon/priv/static;
|
|
|
|
access_log off;
|
2023-12-04 07:18:45 +00:00
|
|
|
add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable";
|
2020-10-09 10:17:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
location ~ ^/(media|proxy) {
|
|
|
|
access_log off;
|
2023-12-04 07:18:45 +00:00
|
|
|
add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable";
|
2020-10-09 10:17:33 +00:00
|
|
|
proxy_pass http://localhost:4000;
|
|
|
|
}
|
|
|
|
|
|
|
|
error_page 500 501 502 503 504 @error;
|
|
|
|
location @error {
|
2020-10-09 15:06:17 +00:00
|
|
|
root /home/mobilizon/live/priv/errors;
|
2020-10-09 10:17:33 +00:00
|
|
|
try_files /error.html 502;
|
2019-10-11 15:03:18 +00:00
|
|
|
}
|
|
|
|
|
2019-03-14 14:00:34 +00:00
|
|
|
}
|