this post was submitted on 06 Jul 2023
5 points (77.8% liked)

Selfhosted

39251 readers
414 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 
  • I tried to bring up an immich server on a cloud provider server with docker, which is successful, but I'd like to organize multiple services into locations under the top level domain, which is a duckdns.org domain with nginx reverse proxy.

  • So I'd like to reach immich under "https://something.duckdns.org/immich/", but I can't seem to make it work, because if I load it, it redirects me to "https://something.duckdns.org/auth/login" (so it uses the top level, not relative to the /immich location)

  • If I manually change it to "https://something.duckdns.org/immich/auth/login" the page loads, but it shows an error message "Unable to connect"

  • If I put it under the / location, it works, but I don't want that

  • Do I need to change something in the docker compose yaml or the .env files to make it work?

  • Or is my nginx config messed up?

  • On my home server I was able to successfuly set up multiple services in a similar way, I just can't make it work with immich-app.

Does anyone has any idea?

Here is my nginx configuration:

`server { listen 80 default_server; listen [::]:80 default_server;

listen 443 ssl default_server;
listen [::]:443 ssl default_server;
ssl_certificate /etc/letsencrypt/live/MYDUCKDNS_DOMAIN_GOES_HERE/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/MYDUCKDNS_DOMAIN_GOES_HERE/privkey.pem; # managed by Certbot

root /var/www/html;

index index.html index.htm index.nginx-debian.html;

server_name _;

location / {
    try_files $uri $uri/ =404;
}

location /immich/ {
    proxy_pass http://localhost:2283/;
    include proxy_params;

    proxy_http_version 1.1;
    proxy_set_header   Upgrade    $http_upgrade;
    proxy_set_header   Connection "upgrade";
    proxy_redirect off;
}

} `

all 6 comments
sorted by: hot top controversial new old
[–] chripede@lemmy.world 3 points 1 year ago

Immich probably uses full paths and expects to be hosted in the root. Hosting on a subdomain will be the easy choice. If you insist on the sub-path you can rewrite requests in nginx to remove part of the path before proxying to immich

[–] Max_P@lemmy.max-p.me 3 points 1 year ago

This has to be explicitly supported by the application, so if there's no way to configure the base path for immich, you're in for a world of pain tricking it into doing it. There's no single NGINX configuration that will just work, you've done nothing wrong there.

Can I ask why you're opposed to using a subdomain: immich.something.duckdns.org? In my experience few self hosted apps cleanly support being hosted on paths and doing so tends to require some advanced reverse proxy settings like rewrites. I don't have immich running right now but I did at one time with that method.

[–] qazwsxedcrfv000@lemmy.unknownsys.com 1 points 1 year ago* (last edited 1 year ago) (1 children)

I am not sure if Immich supports configuring base URL. You can look into that.

If it is not supported, you may need to try your luck with URL rewriting. Nginx can do it natively. Briefly, you need to configure Nginx to strip the /immich from the request URL before proxying the request to the Immich instance.