Can i run my domain like a normal website like a WordPress website in domain.com if i am running n8n.domain.com using docker?

Can i run normal website like a WordPress website in domain.com if i am running n8n in subdomain n8n.domain.com (i am using docker)

Now after starting the docker by command the main domain domain.com is showing 404 error,

if the docker is not running then i am able to access domain.com via internet. If docker starts domain becoming 404 error. How to fix this issue

Hi @jaisonkerala1, welcome to the community :tada:

Can i run normal website like a WordPress website in domain.com if i am running n8n in subdomain n8n.domain.com (i am using docker)

Yes, this is technically possible (and actually what I am doing for my own n8n instance).

Now after starting the docker by command the main domain domain.com is showing 404 error,
if the docker is not running then i am able to access domain.com via internet. If docker starts domain becoming 404 error. How to fix this issue

Which command exactly are you using to start your n8n docker container? This sounds a bit like one of your docker containers might be conflicting with your regular web server on port 80 (HTTP) or 443 (HTTPS).

i am using sudo docker-compose up -d to start the docker, i usually get error that 443 is running already . then i used to stop apache using sudo service apache2 stop , then the error go and n8n works. but at the same time main domain becomes 404

So sounds like that’s it - both docker and your Apache webserver are using 443. sudo service apache2 stop would stop Apache and thus free up port 443.

This wouldn’t usually happen though as n8n is using port 5678 by default. Does your docker-compose.yml file by any chance include traefik or another webserver that tries to expose port 443?

i am a newbie , i did not understand your solution, if i disable appcache running permanently will it solve this issue ?

i am showing my file

services:
  traefik:
    image: "traefik"
    restart: always
    command:
      - "--api=true"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.web.http.redirections.entryPoint.to=websecure"
      - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
      - "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
      - "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ${DATA_FOLDER}/letsencrypt:/letsencrypt
      - /var/run/docker.sock:/var/run/docker.sock:ro

  n8n:
    image: n8nio/n8n
    restart: always
    ports:

Hey @jaisonkerala1, so far I am just making assumptions here. Purely based on your description I assume your Apache webserver is running on port 443 and that one of your docker containers is trying to use that port too, but I don’t know that for sure.

So in a first step you want to verify whether this is actually the case. You can check your docker-compose.yml file (which is the file that defines what happens when you run sudo docker-compose up -d) for lines saying ports:. This will list which ports your docker containers have in use.

What you want to do when running multiple services on the same machine is set up what is called a reverse proxy. This is a web server listening on common ports such as 80 and 443. It will then redirect traffic to other ports on which other services on your systems are listening on.

Edit: I saw your docker compose file just now. So yes, this pretty much seems to be what’s happening. Your docker compose file includes another web server that conflicts with your existing Apache server:

    ports:
      - "80:80"
      - "443:443"

You probably want to get rid of traefik here and instead expose n8n’s port 5678. Your existing Apache webserver could then redirect traffic from it’s own port 80/443 to your n8n container listening on port 5678.

The big problem with this is I won’t be able to help with that. I have never used Apache as a reverse proxy. You might find some instructions for this on the internet and there are also a bunch of users who have done this before, for example here, but I can’t provide a good starting point unfortunately :frowning_face:.

So while this is technically possible, it might be easier to use a separate (virtual) server for your n8n instance (or consider a different server setup with which you are more familiar) if no one else can chip in here.

my use case is i want to have a wordpress website in domain.com and n8n in subdomain.domain.com . so changing port .env file will solve the issue or disabling appcache

websites i am pointing is
opendream.in
console.opendream.in

So the problem with n8n being unable to start without first stopping Apache should be easy to solve. Remove the whole traefik: section from your docker-compose.yml file and add a new section like below to n8n: instead:

    ports:
      - "5678:5678"

This will mean n8n is listening on port 5678 after starting rather than 80 or 443.

However, this does not redirect traffic from n8n.opendream.in port 443 to your n8n port 5678 on which n8n is listening on.

This is where a reverse proxy set up comes into play, which receives all requests from the internet and distributes them to your internal services like so:

(in this example picture it says backend servers, but it might as well be n8n and other docker containers)

This isn’t something I can help with configuring on Apache though unfortunately. You can check out the article behind the above image which might be helpful (but again, I am not familiar with Apache and can’t judge that):

This is a steep learning curve though if this is the first time you do this and as per the thread linked further up isn’t straightforward.

actually now i am planning to reinstall the os of my server. i will explain the 2 method i am going to do tell me which method is correct ?

method 1

  1. installing Ubuntu with webmin and virualmin
    2.seting up a virtual server without appcache enebled domain name opendream.in
    3.seting up a virtual server without appcache enebled domain name console.opendream.in under opendream.in as subdirectory
    3.creating a user named jaison in home directory and giving su acces
    4.installing n8n in console.opendream.in for the user jaison
    5.starting docker

method 2

  1. installing Ubuntu with webmin and virualmin
    2.seting up a virtual server with appcache enebled domain name opendream.in
    3.seting up a virtual server with appcache enebled domain name console.opendream.in under opendream.in as subdirectory
    3.creating a user named jaison in home directory and giving su acces
    4.installing n8n in console.opendream.in for the user jaison
    5.changing port from 80 and 413 to 5678 of yml file
    6.starting docker

So I am not familiar with webmin, virtualmin or appcache meaning I can’t make this call for you I am afraid.

Personally I use a lightweight Ubuntu server setup and caddy as my reverse proxy and webserver. I’ve described such a setup in a blog post a while back. This Wordpress instance runs on the same server as my n8n instance, both are running in their own docker containers with caddy being the reverse proxy in front of them.

This is very different from what you are planning and you might want to discuss this with a system administrator or in a community more familiar with these tools.

Alternatively you could leave your existing server as it is and instead set up your n8n instance on a separate server. The blog post linked above presents a free option for this.

I want n8n to run in my own server,
This time i managed to install nginx and unstalled apache
Now every domain and subdomain is working
But n8n is not pointing to console.saharagroundwater. com

But its available in opendream.in:5678

I don’t understand why it is happening

This time i used the pm2 method inted of docker

Using 2 articles

And

Everything is working it seems i did not get any errors while executing commands. And i am able to give ssl also for any domains

Can you help me

@MutedJam

I don’t think I understand the current status at this time:

But n8n is not pointing to console.saharagroundwater. com
But its available in opendream.in:5678

So you want n8n to be available under console.saharagroundwater.com? Is the DNS record for this domain pointing to your server running n8n? From quickly querying this URL it doesn’t seem like a valid domain:

So in a first step probably need update the A and/or AAAA records of console.saharagroundwater.com so they point to the right server.

Then you would need to set up an nginx server block listening for console.saharagroundwater.com requests on ports 443 and 80 (these are the ports browsers will use by default). It seems the latest blog post you have linked suggests modifying the /etc/nginx/conf.d/n8n.conf file for this purpose. Can you please confirm the current file content on your side (you can get these by running cat /etc/nginx/conf.d/n8n.conf)?

That looks like you’re setting a record for console.opendream.in though rather than console.saharagroundwater.com. Is console.opendream.in the domain name you want to use and is 156.67.210.167 the server you’re running n8n on?

If so and assuming n8n is up and running on port 5678, you would need to check the nginx configuration in your next step.

in ecosystem file


module.exports = {
    apps : [{
        name   : "n8n",
        env: {
            N8N_BASIC_AUTH_ACTIVE:true,
            N8N_BASIC_AUTH_USER:"jaison",
            N8N_BASIC_AUTH_PASSWORD:"password",
            N8N_PROTOCOL: "https",
            WEBHOOK_TUNNEL_URL: "https://console.opendream.in/",
            N8N_HOST: "console.opendream.in"
        }
    }]
}
~               

Okay, and what does your nginx config file look like?

jaison@saharagroundwater:~$ sudo restart Nginx
sudo: restart: command not found
jaison@saharagroundwater:~$ pm2 restart ecosystem.config.js
[PM2] Applying action restartProcessId on app [n8n](ids: [ 0 ])
[PM2] n8n
┌─────┬────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user
│ watching │
├─────┼────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ n8n │ default │ N/A │ fork │ 7074 │ 0s │ 410 │ online │ 0% │ 4.0kb │ jaison
│ disabled │
└─────┴────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
jaison@saharagroundwater:~$ sudosudo systemctl restart nginx restart Nginx
-su: sudosudo: command not found
jaison@saharagroundwater:~$ pm2 restart ecosystem.config.js
[PM2] Applying action restartProcessId on app [n8n](ids: [ 0 ])
[PM2] n8n
┌─────┬────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user
│ watching │
├─────┼────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ n8n │ default │ N/A │ fork │ 7128 │ 0s │ 414 │ online │ 0% │ 808.0kb │ jaison
│ disabled │
└─────┴────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
jaison@saharagroundwater:~$ pm2 start n8n
[PM2] Applying action restartProcessId on app [n8n](ids: [ 0 ])
[PM2] n8n
[PM2] Process successfully started
┌─────┬────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user
│ watching │
├─────┼────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ n8n │ default │ N/A │ fork │ 7159 │ 0s │ 416 │ online │ 0% │ 4.0kb │ jaison
│ disabled │
└─────┴────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
jaison@saharagroundwater:~$ sudo systemctl restart nginx
jaison@saharagroundwater:~$ pm2 restart ecosystem.config.js
[PM2] Applying action restartProcessId on app [n8n](ids: [ 0 ])
[PM2] n8n
┌─────┬────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user
│ watching │
├─────┼────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ n8n │ default │ N/A │ fork │ 7266 │ 0s │ 424 │ online │ 0% │ 4.0kb │ jaison
│ disabled │
└─────┴────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘

This looks okay to me for the most part,

though you probably want to replace proxy_pass http://opendream.in:5678; with proxy_pass http://localhost:5678; (assuming n8n is running on the same machine as nginx).

Did you run sudo systemctl restart nginx after changing the file? Which error are you seeing when visiting console.opendream.in afterwards?