Apache Configuration for N8N

Hi all,
Hope you are doing fine. My project is almost done but there is still one last issue on it. I read some other posts but no clue…
Here is the situation :
N8N is installed on an ubuntu server.
I can access to it via a laptop.

  1. In apache2 (ubuntu server) :

<VirtualHost *:443>
ServerName 1.2.3.4
DocumentRoot /var/www/localhost
SSLEngine on
SSLCertificateFile /etc/ssl/selfsigned.crt
SSLCertificateKeyFile /etc/ssl/selfsigned.key
SSLVerifyClient require
SSLVerifyDepth 2
SSLCADNRequestFile /etc/ssl/selfsigned.crt
SSLOptions +StdEnvVars
SSLCACertificateFile /etc/ssl/selfsigned-ca.crt
ProxyPreserveHost On
ProxyPass / http://1.2.3.4:5678/webhook/web1
ProxyPassReverse / http://1.2.3.4:5678/webhook/web1

  1. To access on my project : https://1.2.3.4
    Access is ok after a certificate validation and url showing http://1.2.3.4:5678/webhook/web1

  2. From http://1.2.3.4:5678/webhook/web1
    I can execute some N8N workflow so after click on my webpage based on N8N, the URL change to
    http://1.2.3.4:5678/webhook/web2
    This is working fine UNTIL I put the firewall enable!

The thing is if the port 5678 is deny the access to http://1.2.3.4:5678/webhook/web1 is ok but acces to http://1.2.3.4:5678/webhook/web2 is not possible.
If port 5678 is allowed, http://1.2.3.4:5678/webhook/web2 is ok but the access by certificat is not use anymore…
Pretty sure that my apache configuration is wrong but I have no clue to fix it…
Thanks a lot

Hey @herrT15,

Don’t forget that self hosting n8n is considered to be an advanced option and we expect there to be a solid understanding of the environment you are using.

Looking at your config I am not sure why you are using /webhook/web1 I would expect it to just be the local address on 5678. I would then expect everything to be accessed over https using the self signed certificate (I would use Lets Encrypt).

The other side of this is do you even need Apache? Could you use Traefik instead with our standard docker setup or do you have multiple sites running.

Hi,

Apache is only use for certificate authentification which can be done by Traefik also.
I will give it a try tomorrow by following these two tutorials

Thanks

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.