Use an upstream for reverse proxy so future modifications are simplified

This commit is contained in:
Mark Felder 2020-09-21 16:19:08 -05:00
parent ade7fede71
commit 8906f30ba1
1 changed files with 9 additions and 5 deletions

View File

@ -9,6 +9,12 @@
proxy_cache_path /tmp/pleroma-media-cache levels=1:2 keys_zone=pleroma_media_cache:10m max_size=10g proxy_cache_path /tmp/pleroma-media-cache levels=1:2 keys_zone=pleroma_media_cache:10m max_size=10g
inactive=720m use_temp_path=off; inactive=720m use_temp_path=off;
# this is explicitly IPv4 since Pleroma.Web.Endpoint binds on IPv4 only
# and `localhost.` resolves to [::0] on some systems: see issue #930
upstream phoenix {
server 127.0.0.1:4000 max_fails=5 fail_timeout=60s;
}
server { server {
server_name example.tld; server_name example.tld;
@ -72,9 +78,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location / { location / {
# this is explicitly IPv4 since Pleroma.Web.Endpoint binds on IPv4 only proxy_pass http://phoenix;
# and `localhost.` resolves to [::0] on some systems: see issue #930
proxy_pass http://127.0.0.1:4000;
} }
location ~ ^/(media|proxy) { location ~ ^/(media|proxy) {
@ -87,11 +91,11 @@ server {
proxy_ignore_client_abort on; proxy_ignore_client_abort on;
proxy_buffering on; proxy_buffering on;
chunked_transfer_encoding on; chunked_transfer_encoding on;
proxy_pass http://127.0.0.1:4000; proxy_pass http://phoenix;
} }
location /api/fedsocket/v1 { location /api/fedsocket/v1 {
proxy_request_buffering off; proxy_request_buffering off;
proxy_pass http://127.0.0.1:4000/api/fedsocket/v1; proxy_pass http://phoenix/api/fedsocket/v1;
} }
} }