Caveat, I am running n8n in docker but i also have 100+ virtual web hosts in my apache config on the same server.
This worked for me to get n8n running on the same box.
I had to add in the Proxy modules for Apache
Using Ubuntu Linux 22.04 this is
a2enmod proxy
a2enmod proxy_http
a2enmod ssl
Reload the apache configuration’
systemctl reload apache2
I then set up 2 new virtual host in apache.
<VirtualHost *:443>
ServerName anything.example.com
ServerAdmin webmaster@localhost
ServerAlias anything.example.com
ErrorLog ${APACHE_LOG_DIR}/reverse-proxy-anything.example.com.error.log
CustomLog ${APACHE_LOG_DIR}/reverse-proxy-anything.example.com.access.log combined
ProxyPreserveHost On
ProxyPass / http://localhost:5678/
ProxyPassReverse / http://localhost:5678/
</VirtualHost>
And the HTTP
<VirtualHost *:80>
ServerName anything.example.com
ErrorLog ${APACHE_LOG_DIR}/reverse-proxy-http.anything.example.com.error.log
CustomLog ${APACHE_LOG_DIR}/reverse-proxy-http.anything.example.comccess.log combined
ProxyPreserveHost On
ProxyPass / http://localhost5678:/
ProxyPassReverse / http://localhost:5678/
RewriteEngine on
RewriteCond %{SERVER_NAME} =anything.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
I then ran ‘certbot --apache’ and enabled letsencrypt for TLS
certbot --apache
restarted apache2
Stopped the docker instance - I only have n8n running in docker currently
docker compose down
In the n8n docker image i removed any reference to Traefik then started docker again.
docker compose up -d
I can now hit my n8n URL and get to the system easily.
Thanks to @netroy and @Jon for pointing me in the correct direction.