imagegenius / docker-immich

Monolithic (Single) Docker Container for Immich

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unraid + SWAG (Paths not subdomains) Help needed please

7hr08ik opened this issue · comments

Hey,

I'm having some problems getting Immich accessible via my SWAG proxy. Firstly, yes my SWAG is setup correctly, and up to date. I have Jellyfin running and accessible through my domain, so I''m pretty sure it's running just fine.

I am not using subdomains because I cant get them to work. Only by editing the site configs, can I get things to work. I'm not too good at web proxy stuff. I have everything setup through duckdns, (which from my understanding is why i cant get subdomains working) setup as so;

mydomain.duckdns.org/jellyfin (This works just fine)
mydomain.duckdns.org/radarr (This works just fine)
mydomain.duckdns.org/sonarr (This works just fine)
mydomain.duckdns.org/immich (Seems borked, just returns a blank screen)

I know the proxy is working, because if i change anything, I get the nginx error page. But when i have it set to point to the correct port, I am met with an empty blank page. If i check the page source, it is identical to the page source for the locally accessed immich page (192.168.1.100:8282)

I looked through some of the old issues and found this Funnily enough, my port is also 8282 :P
If i go into SWAG docker, and run curl http://immich:8282/auth/login
I get curl: (6) Could not resolve host: immich
If I run curl http://192.168.0.100:8282/auth/login I get back all the HTML code, so that's working just fine.

My SWAG config is as follows

## Version 2024/03/06 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/site-confs/default.conf.sample

# redirect all traffic to https
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    location / {
        return 301 https://$host$request_uri;
    }
}

# main server block
server {
    listen 443 ssl http2 default_server;
    listen [::]:443 ssl http2 default_server;

    server_name _;

    include /config/nginx/ssl.conf;

    root /config/www;
    index index.html index.htm index.php;

    # enable subfolder method reverse proxy confs
    include /config/nginx/proxy-confs/*.subfolder.conf;

    # enable for ldap auth (requires ldap-location.conf in the location block)
    #include /config/nginx/ldap-server.conf;

    # enable for Authelia (requires authelia-location.conf in the location block)
    #include /config/nginx/authelia-server.conf;

    # enable for Authentik (requires authentik-location.conf in the location block)
    #include /config/nginx/authentik-server.conf;

    location / {
        # enable for basic auth
        #auth_basic "Restricted";
        #auth_basic_user_file /config/nginx/.htpasswd;

        # enable for ldap auth (requires ldap-server.conf in the server block)
        #include /config/nginx/ldap-location.conf;

        # enable for Authelia (requires authelia-server.conf in the server block)
        #include /config/nginx/authelia-location.conf;

        # enable for Authentik (requires authentik-server.conf in the server block)
        #include /config/nginx/authentik-location.conf;

        try_files $uri $uri/ /index.html /index.htm /index.php$is_args$args;
    }

    location ~ ^(.+\.php)(.*)$ {
        # enable the next two lines for http auth
        #auth_basic "Restricted";
        #auth_basic_user_file /config/nginx/.htpasswd;

        # enable for ldap auth (requires ldap-server.conf in the server block)
        #include /config/nginx/ldap-location.conf;

        # enable for Authelia (requires authelia-server.conf in the server block)
        #include /config/nginx/authelia-location.conf;

        # enable for Authentik (requires authentik-server.conf in the server block)
        #include /config/nginx/authentik-location.conf;

        fastcgi_split_path_info ^(.+\.php)(.*)$;
        if (!-f $document_root$fastcgi_script_name) { return 404; }
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include /etc/nginx/fastcgi_params;
    }

    location /jellyfin {
        return 301 $scheme://$host/jellyfin/;
    }

    location ^~ /jellyfin/ {
        proxy_pass http://192.168.0.100:8096;
    }

...
...
...

    location /immich {
        return 301 $scheme://$host/immich/;
    }

    location ^~ /immich/ {
        proxy_pass http://192.168.0.100:8282;
    }

    # deny access to .htaccess/.htpasswd files
    location ~ /\.ht {
        deny all;
    }
}

# enable subdomain method reverse proxy confs
include /config/nginx/proxy-confs/*.subdomain.conf;
# enable proxy cache for auth
proxy_cache_path cache/ keys_zone=auth_cache:10m;

Any help is very much appreciated.

Would I be better off buying a domain, and running everything in subdomains instead?

I figured it out.

DuckDNS can be used with sub-subdomains.

Edit SWAG Docker as so;

    VALIDATION: dns
    SUBDOMAINS: wildcard
    DNSPLUGIN: duckdns

Then reboot the container, follow loggs to see it updating DNS records etc.

Now I am able to use subdomains, and access immich;

    https://immich.mydomain.duckdns.org - (WORKS)

    https://mydomain.duckdns.org/immich - (Fails - With blank screen but working in the logs)

Immich does not support base url immich-app/immich#1679