From 45cae54638f15bb8badf24866dc2a6e2f360994e Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Mon, 2 May 2022 15:05:27 +0000 Subject: [PATCH] mastodon: nginx routing works --- mastodon/docker-compose.yaml | 2 +- mastodon/env.production | 4 ++- .../data/nginx/templates/social.conf.template | 27 +++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 nginx/data/nginx/templates/social.conf.template diff --git a/mastodon/docker-compose.yaml b/mastodon/docker-compose.yaml index b4fb1c2..2a3f2cf 100644 --- a/mastodon/docker-compose.yaml +++ b/mastodon/docker-compose.yaml @@ -7,7 +7,7 @@ services: networks: - internal_network healthcheck: - test: ['CMD', 'pg_isready', '-U', "mastodon"] + test: ['CMD', 'pg_isready', '-U', "mastodon", "-d", "mastodon_production"] volumes: - ./database:/var/lib/postgresql/data environment: diff --git a/mastodon/env.production b/mastodon/env.production index af94eff..dcb6307 100644 --- a/mastodon/env.production +++ b/mastodon/env.production @@ -14,7 +14,9 @@ # ---------- # This identifies your server and cannot be changed safely later # ---------- -LOCAL_DOMAIN=spacestation +LOCAL_DOMAIN=social.example.com +#WEB_DOMAIN=social.example.com +TRUSTED_PROXY_IP=10.1.0.142 # Redis # ----- diff --git a/nginx/data/nginx/templates/social.conf.template b/nginx/data/nginx/templates/social.conf.template new file mode 100644 index 0000000..d8aa47d --- /dev/null +++ b/nginx/data/nginx/templates/social.conf.template @@ -0,0 +1,27 @@ +server { + listen 80; + server_name social.${DOMAIN_NAME}; + location / { + return 301 https://$host$request_uri; + } +} + +server { + server_name social.${DOMAIN_NAME}; + client_max_body_size 128m; + + location / { + proxy_pass http://spacestation:6001; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-Proto https; + } + + listen 443 ssl; + ssl_certificate /etc/letsencrypt/live/${DOMAIN_NAME}/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/${DOMAIN_NAME}/privkey.pem; + include /etc/letsencrypt/options-ssl-nginx.conf; + ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; +} + +