From: Dessalines Date: Tue, 22 Sep 2020 16:28:16 +0000 (-0500) Subject: Fix nginx docs, fix test deploy. X-Git-Url: http://these/git/%7B%60/feeds/front/static/%7BpictrsAvatarThumbnail%28this.state.siteRes.site.icon%29%7D?a=commitdiff_plain;h=2bee3ac33bb6ca43b17c804f3b2dcb4c9a0b83bb;p=lemmy.git Fix nginx docs, fix test deploy. --- diff --git a/ansible/templates/nginx.conf b/ansible/templates/nginx.conf index 5c02eb13..7f13259a 100644 --- a/ansible/templates/nginx.conf +++ b/ansible/templates/nginx.conf @@ -51,17 +51,27 @@ server { # Upload limit for pictrs client_max_body_size 20M; - # lemmy api - location /api/v1 { - proxy_pass http://0.0.0.0:8536/api/v1; + # frontend + location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - # Cuts off the trailing slash on URLs to make them valid + set $proxpass "http://0.0.0.0:{{ lemmy_ui_port }}"; + if ($http_accept = "application/activity+json") { + set $proxpass "http://0.0.0.0:{{ lemmy_port }}"; + } + if ($request_method = POST) { + set $proxpass "http://0.0.0.0:{{ lemmy_port }}"; + } + proxy_pass $proxpass; + rewrite ^(.+)/+$ $1 permanent; + } - # WebSocket support + # backend + location ~ ^/(api|docs|pictrs|feeds|nodeinfo|.well-known) { + proxy_pass http://0.0.0.0:{{ lemmy_port }}; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; @@ -70,36 +80,12 @@ server { limit_req zone=lemmy_ratelimit burst=30 nodelay; } - # Docs - location /docs { - proxy_pass http://0.0.0.0:8536/docs; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header Host $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } - - # lemmy-ui - location / { - proxy_pass http://0.0.0.0:1235; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header Host $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } - # Redirect pictshare images to pictrs location ~ /pictshare/(.*)$ { return 301 /pictrs/image/$1; } - # Separate location block to disable rate limiting for images - location /pictrs { - proxy_pass http://0.0.0.0:8536/pictrs; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header Host $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } - location /iframely/ { proxy_pass http://0.0.0.0:8061/; proxy_set_header X-Real-IP $remote_addr; diff --git a/docker/dev/test_deploy.sh b/docker/dev/test_deploy.sh index 7641c940..9a734be0 100755 --- a/docker/dev/test_deploy.sh +++ b/docker/dev/test_deploy.sh @@ -1,18 +1,14 @@ #!/bin/bash set -e -BRANCH=$1 - -git checkout $BRANCH - export COMPOSE_DOCKER_CLI_BUILD=1 export DOCKER_BUILDKIT=1 # Rebuilding dev docker -sudo docker build ../../ -f . -t "dessalines/lemmy:$BRANCH" -sudo docker push "dessalines/lemmy:$BRANCH" +sudo docker build ../../ -f . -t "dessalines/lemmy:dev" +sudo docker push "dessalines/lemmy:dev" # Run the playbook -pushd ../../../lemmy-ansible -ansible-playbook -i test playbooks/site.yml -popd +# pushd ../../../lemmy-ansible +# ansible-playbook -i test playbooks/site.yml +# popd