|
|
|
@ -1,22 +1,18 @@
|
|
|
|
|
# nginx example config
|
|
|
|
|
# replace {{yourdomain}} and review the certbot/letsencrypt config
|
|
|
|
|
worker_processes 1;
|
|
|
|
|
events {
|
|
|
|
|
worker_connections 1024;
|
|
|
|
|
}
|
|
|
|
|
http {
|
|
|
|
|
limit_req_zone $binary_remote_addr zone={{yourdomain}}_ratelimit:10m rate=1r/s;
|
|
|
|
|
|
|
|
|
|
upstream lemmy {
|
|
|
|
|
limit_req_zone $binary_remote_addr zone={{yourdomain}}_ratelimit:10m rate=1r/s;
|
|
|
|
|
|
|
|
|
|
upstream lemmy {
|
|
|
|
|
# this needs to map to the lemmy (server) docker service hostname
|
|
|
|
|
server "lemmy:8536";
|
|
|
|
|
}
|
|
|
|
|
upstream lemmy-ui {
|
|
|
|
|
}
|
|
|
|
|
upstream lemmy-ui {
|
|
|
|
|
# this needs to map to the lemmy-ui docker service hostname
|
|
|
|
|
server "lemmy-ui:1234";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
server {
|
|
|
|
|
server {
|
|
|
|
|
# allow letsencrypt challenge
|
|
|
|
|
# redirect everything else to 443
|
|
|
|
|
listen 80;
|
|
|
|
@ -28,9 +24,9 @@ http {
|
|
|
|
|
location / {
|
|
|
|
|
return 301 https://$host$request_uri;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
server {
|
|
|
|
|
server {
|
|
|
|
|
listen 443 ssl http2;
|
|
|
|
|
listen [::]:443 ssl http2;
|
|
|
|
|
server_name {{yourdomain}};
|
|
|
|
@ -137,16 +133,15 @@ http {
|
|
|
|
|
location ~ /pictshare/(.*)$ {
|
|
|
|
|
return 301 /pictrs/image/$1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Anonymize IP addresses
|
|
|
|
|
# https://www.supertechcrew.com/anonymizing-logs-nginx-apache/
|
|
|
|
|
map $remote_addr $remote_addr_anon {
|
|
|
|
|
# Anonymize IP addresses
|
|
|
|
|
# https://www.supertechcrew.com/anonymizing-logs-nginx-apache/
|
|
|
|
|
map $remote_addr $remote_addr_anon {
|
|
|
|
|
~(?P<ip>\d+\.\d+\.\d+)\. $ip.0;
|
|
|
|
|
~(?P<ip>[^:]+:[^:]+): $ip::;
|
|
|
|
|
127.0.0.1 $remote_addr;
|
|
|
|
|
::1 $remote_addr;
|
|
|
|
|
default 0.0.0.0;
|
|
|
|
|
}
|
|
|
|
|
access_log /var/log/nginx/access.log combined;
|
|
|
|
|
}
|
|
|
|
|
access_log /var/log/nginx/access.log combined;
|
|
|
|
|