Fix invalid config in docker/prod (fixes #2520) (#2524)

This commit is contained in:
Nutomic 2022-11-02 18:50:09 +00:00 committed by GitHub
parent ed9e91345a
commit 28eade6168
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 134 additions and 138 deletions

@ -1 +1 @@
Subproject commit f5d6f0eabafd559417bf8f203fd655f7858bffcf Subproject commit 454debaede4cc932ac15fea9bf620cf1daf1ae4c

View file

@ -34,6 +34,7 @@ services:
networks: networks:
- lemmyinternal - lemmyinternal
restart: always restart: always
environment:
- RUST_LOG="warn,lemmy_server=info,lemmy_api=info,lemmy_api_common=info,lemmy_api_crud=info,lemmy_apub=info,lemmy_db_schema=info,lemmy_db_views=info,lemmy_db_views_actor=info,lemmy_db_views_moderator=info,lemmy_routes=info,lemmy_utils=info,lemmy_websocket=info" - RUST_LOG="warn,lemmy_server=info,lemmy_api=info,lemmy_api_common=info,lemmy_api_crud=info,lemmy_apub=info,lemmy_db_schema=info,lemmy_db_views=info,lemmy_db_views_actor=info,lemmy_db_views_moderator=info,lemmy_routes=info,lemmy_utils=info,lemmy_websocket=info"
volumes: volumes:
- ./lemmy.hjson:/config/config.hjson - ./lemmy.hjson:/config/config.hjson

View file

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