diff --git a/ansible/templates/nginx.conf b/ansible/templates/nginx.conf index 886ce0b78..7929ccc59 100644 --- a/ansible/templates/nginx.conf +++ b/ansible/templates/nginx.conf @@ -51,23 +51,41 @@ 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; + 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; + } + + # lemmy-isomorphic-ui 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; + 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; + } - # 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; - } # Redirect pictshare images to pictrs location ~ /pictshare/(.*)$ { diff --git a/config/defaults.hjson b/config/defaults.hjson index 591f68f6d..1da2a16cf 100644 --- a/config/defaults.hjson +++ b/config/defaults.hjson @@ -33,8 +33,6 @@ port: 8536 # json web token for authorization between server and client jwt_secret: "changeme" - # The location of the frontend - front_end_dir: "../ui/dist" # address where pictrs is available pictrs_url: "http://pictrs:8080" # rate limits for various user actions, by user ip diff --git a/docker/dev/docker-compose.yml b/docker/dev/docker-compose.yml index b92ee52a7..2a81861f4 100644 --- a/docker/dev/docker-compose.yml +++ b/docker/dev/docker-compose.yml @@ -16,11 +16,14 @@ services: - postgres - iframely lemmy-isomorphic-ui: - image: lemmy-isomorphic-ui:latest + image: dessalines/lemmy-isomorphic-ui:v0.0.5 + # image: lemmy-isomorphic-ui:latest ports: - "1235:1234" environment: - - LEMMY_HOST=lemmy + - LEMMY_INTERNAL_HOST=lemmy:8536 + - LEMMY_EXTERNAL_HOST=localhost:8536 + - LEMMY_HTTPS=false depends_on: - lemmy diff --git a/docker/lemmy.hjson b/docker/lemmy.hjson index d17394767..49138d0ae 100644 --- a/docker/lemmy.hjson +++ b/docker/lemmy.hjson @@ -30,8 +30,6 @@ # host where postgres is running host: "postgres" } - # The location of the frontend - front_end_dir: "/app/dist" # # optional: email sending configuration # email: { # # hostname of the smtp server diff --git a/docker/prod/docker-compose.yml b/docker/prod/docker-compose.yml index c56f14694..9e9add246 100644 --- a/docker/prod/docker-compose.yml +++ b/docker/prod/docker-compose.yml @@ -25,6 +25,18 @@ services: - pictrs - iframely + lemmy-isomorphic-ui: + image: dessalines/lemmy-isomorphic-ui:v0.0.5 + # image: lemmy-isomorphic-ui:latest + ports: + - "1235:1234" + environment: + - LEMMY_INTERNAL_HOST=lemmy:8536 + - LEMMY_EXTERNAL_HOST=localhost:8536 + - LEMMY_HTTPS=false + depends_on: + - lemmy + pictrs: image: asonix/pictrs:v0.1.13-r0 ports: diff --git a/src/main.rs b/src/main.rs index 3289f8c4f..fe2f46d93 100644 --- a/src/main.rs +++ b/src/main.rs @@ -98,7 +98,7 @@ async fn main() -> Result<(), LemmyError> { .configure(|cfg| images::config(cfg, &rate_limiter)) .configure(nodeinfo::config) .configure(webfinger::config) - .service(actix_files::Files::new("/docs", "/documentation")) + .service(actix_files::Files::new("/docs", "/app/documentation")) }) .bind((settings.bind, settings.port))? .run()