Difficulty deploying n8n with docker while using NGINX on the Docker Host

Describe the issue

I am trying to run n8n within a docker container while running NGINX on the host itself. My intent is to host it in a subfolder like www.hostname.com/n8n. The thought process is that this would share my SSL keys across all of my docker apps and allow NGINX to still function and serve 404 even if docker is down. I’m a novice hobbyist sysadmin that is trying to learn by doing but nothing is truly connecting the dots and speaking to my exact scenario.

This is the closest existing question to my issue but it reads like both NGINX and n8n are running bare metal here and not matching what I need.
N8N as a subfolder with nginx - Questions - n8n

What is the error message (if any)?

I can get the docker to answer at the domain address, but all I get is a blank screen. Viewing source shows that the main page is being served but non of the dependencies can apparently be accessed. it’s as if you took index.htm and copied it to another system, opened it and you found everything missing.

Information on your n8n setup

  • n8n version: Version: 0.191.1 (Docker)
  • Database you’re using (default: SQLite):SQLite
  • Running n8n with the execution process [own(default), main]: (??? Not sure)
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

Hi @Scyne, welcome to the community!

I gave up on trying to use custom paths for any web application (not just n8n) quite a while back and switched to subdomains instead. It almost always is a headache to get everything up to the path/rewrite rules right when using paths.

In case you do want to go down that route you might want to check out this example for traefik and try to create a corresponding nginx server block: n8n/docker/compose/subfolderWithSSL at master · n8n-io/n8n · GitHub

1 Like

Yeah I gave up and allowed my app to join the subdomain master race. This server itself is a subdomain so the app is living at n8n.subdomain.hostname.com but at least this works. Who said that automations need to be pretty?