]> Untitled Git - lemmy.git/blobdiff - ansible/templates/nginx.conf
Isomorphic docker (#1124)
[lemmy.git] / ansible / templates / nginx.conf
index 092f855203ad8951d1fa877a7d4985cfd058646f..5c02eb137a4bef7f05ff2f25671688d87957c909 100644 (file)
@@ -51,29 +51,55 @@ server {
     # Upload limit for pictrs
     client_max_body_size 20M;
 
-    # Rate limit
-    limit_req zone=lemmy_ratelimit burst=30 nodelay;
+    # lemmy api
+    location /api/v1 {
+      proxy_pass http://0.0.0.0:8536/api/v1;
+      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 / {
-        proxy_pass http://0.0.0.0:8536;
-        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
+      rewrite ^(.+)/+$ $1 permanent;
+
+      # WebSocket support
+      proxy_http_version 1.1;
+      proxy_set_header Upgrade $http_upgrade;
+      proxy_set_header Connection "upgrade";
+
+      # Rate limit
+      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;
+    }
 
-        # Cuts off the trailing slash on URLs to make them valid
-        rewrite ^(.+)/+$ $1 permanent;
+    # 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;
+    }
 
-        # WebSocket support
-        proxy_http_version 1.1;
-        proxy_set_header Upgrade $http_upgrade;
-        proxy_set_header Connection "upgrade";
-    }    
 
     # 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;