79 lines
2.4 KiB
Nginx Configuration File
79 lines
2.4 KiB
Nginx Configuration File
# Example nginx site config for Mobilizon on Debian
|
|
#
|
|
# 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 default_server;
|
|
listen [::]:80 default_server;
|
|
|
|
# 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;
|
|
}
|
|
|
|
server {
|
|
server_name example.tld;
|
|
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
|
|
include /etc/nginx/snippets/snakeoil.conf;
|
|
# Replace the above line with the following once you have your own 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;
|
|
|
|
add_header Strict-Transport-Security "max-age=31536000";
|
|
|
|
# the nginx default is 1m, not enough for large media uploads
|
|
client_max_body_size 16m;
|
|
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
include proxy_params;
|
|
|
|
location / {
|
|
expires off;
|
|
add_header Cache-Control "public, max-age=0, s-maxage=0, must-revalidate" always;
|
|
proxy_pass http://127.0.0.1:4000;
|
|
}
|
|
|
|
# Let's Encrypt keeps its files here
|
|
location ^~ '/.well-known/acme-challenge' {
|
|
root /var/www/certbot;
|
|
default_type "text/plain";
|
|
}
|
|
|
|
location ~ ^/(assets|img) {
|
|
root /var/lib/mobilizon/www/static;
|
|
access_log off;
|
|
add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable";
|
|
}
|
|
|
|
location ~ ^/(media|proxy) {
|
|
access_log off;
|
|
add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable";
|
|
proxy_pass http://127.0.0.1:4000;
|
|
}
|
|
|
|
error_page 500 501 502 503 504 @error;
|
|
location @error {
|
|
root /var/lib/mobilizon/www/errors;
|
|
try_files /error.html 502;
|
|
}
|
|
|
|
}
|
|
|