ditto/installation/ditto.conf

69 lines
1.4 KiB
Plaintext
Raw Normal View History

2024-06-13 02:10:56 +00:00
# Nginx configuration for Ditto.
2023-09-11 20:09:20 +00:00
#
# Edit this file to change occurences of "example.com" to your own domain.
upstream ditto {
2024-05-16 13:08:36 +00:00
server 127.0.0.1:4036;
2023-09-11 20:09:20 +00:00
}
server {
listen 80;
listen [::]:80;
location /.well-known/acme-challenge/ { allow all; }
location / { return 301 https://$host$request_uri; }
}
server {
server_name example.com;
keepalive_timeout 70;
sendfile on;
client_max_body_size 100m;
ignore_invalid_headers off;
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-Forwarded-For $proxy_add_x_forwarded_for;
2024-06-13 02:10:56 +00:00
root /opt/ditto/public;
location @spa {
try_files /index.html /dev/null;
}
location @frontend {
try_files $uri @ditto-static;
}
location @ditto-static {
root /opt/ditto/static;
try_files $uri @spa;
}
2023-10-12 02:31:53 +00:00
location /packs {
add_header Cache-Control "public, max-age=31536000, immutable";
add_header Strict-Transport-Security "max-age=31536000" always;
root /opt/ditto/public;
}
2024-06-13 02:10:56 +00:00
location ~ ^/(instance|sw\.js$|sw\.js\.map$) {
2023-10-12 02:31:53 +00:00
root /opt/ditto/public;
2024-06-13 02:10:56 +00:00
try_files $uri =404;
2023-10-12 02:31:53 +00:00
}
2024-06-13 02:10:56 +00:00
location = /favicon.ico {
2023-10-12 02:31:53 +00:00
root /opt/ditto/static;
2024-06-13 02:10:56 +00:00
try_files $uri =404;
2023-10-12 02:31:53 +00:00
}
2024-06-13 02:10:56 +00:00
location ~ ^/(api|relay|oauth|manifest.json|nodeinfo|.well-known/(nodeinfo|nostr.json)) {
2023-09-11 20:09:20 +00:00
proxy_pass http://ditto;
}
location / {
2024-06-13 02:10:56 +00:00
try_files /dev/null @frontend;
2023-09-11 20:09:20 +00:00
}
}