How can I install n8n with Plesk obsidian 18?

Hello Community, Please I need your help to make n8n run on a subdomain managed by Plesk Obsidian Panel.
I Folowed this documentation how is run with node index.js possible? · Issue #9 · n8n-io/n8n · GitHub
But unfortonly it did not work with me , I dont know if I did a mistake or no ! But i will tell you
what I did exactly and I hope you help to resolve the problem!

So I started from scratch by creating new VPS on Digitalocean.

1) I start by creating fresh Droplet (Debian 9 64bit).

2) I Installed New Plesk Obsidian 18.0 on the VPS. (Via SSH)

3) Using Plesk I added the main Domain (besthotelguides . com).

4) I Created subdomain (n8n . besthotelguides . com) Using Plesk.

5) I Installed SSL on both ; Main Domain and Subdomain.

6) I Installed Nodejs from (Plesk tools->update->Add New Component).
Plesk 18 Already has the NodeJs v 12.4.0 Like used on the documentation of @sutidor

7) I disabled PHP & FastCGI of the subdomain from the Hosting Setting of Plesk Panel.

8) I created New MySql Database n8n (I pass the PostgreSql Installation because I try 5 Time installing it and no Result , So I decide in the new VPS to use MySql, because I read that lastest version of n8n is compatible with MAriaDB/MySql)

9) Via SSH and folowing the documentation

9.1) cd /var/www/vhosts/besthotelguides.com/n8n.besthotelguides.com/

9.2) npm init --yes
here i got an error (-bash: npm: command not found)
So I fix it By Installing npm with those commands:
9.2.1) curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
9.2.2) apt-get update && sudo apt-get install yarn
9.2.3) apt-get install nodejs npm
9.2.4) npm -v and the result is 6.14.4. so here npm is installed.

Backing to the step 9.2 executing the command npm init --yes and the result is :

{
  "name": "n8n.besthotelguides.com",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": ""
}

9.3) npm install n8n
After excuting this command this is the result

`npm WARN deprecated [email protected]: This version of pg-promise is obsolete. You should update to a newer version.

> [email protected] install /var/www/vhosts/besthotelguides.com/n8n.besthotelguides.com/node_modules/mmmagic
> node-gyp rebuild

make: Entering directory '/var/www/vhosts/besthotelguides.com/n8n.besthotelguides.com/node_modules/mmmagic/build'
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/apprentice.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/apptype.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/ascmagic.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/cdf.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/cdf_time.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/compress.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/der.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/encoding.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/fsmagic.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/funcs.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/is_tar.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/magic.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/print.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/readcdf.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/readelf.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/softmagic.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/fmtcheck.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/strlcat.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/strlcpy.o
  AR(target) Release/obj.target/deps/libmagic/magic.a
  COPY Release/magic.a
  CXX(target) Release/obj.target/magic/src/binding.o
  SOLINK_MODULE(target) Release/obj.target/magic.node
  COPY Release/magic.node
make: Leaving directory '/var/www/vhosts/besthotelguides.com/n8n.besthotelguides.com/node_modules/mmmagic/build'

> [email protected] install /var/www/vhosts/besthotelguides.com/n8n.besthotelguides.com/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using needle for node-pre-gyp https download
[sqlite3] Success: "/var/www/vhosts/besthotelguides.com/n8n.besthotelguides.com/node_modules/sqlite3/lib/binding/node-v72-linux-x64/node_sqlite3.node" is installed via remote
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] requires a peer of request@^2.34 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of request@^2.34 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

+ [email protected]
added 510 packages from 707 contributors and audited 1292 packages in 47.133s

8 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities`

9.4) executing the command npm install sqlite3 --save
and this is the result of this command

> [email protected] install /var/www/vhosts/besthotelguides.com/n8n.besthotelguides.com/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using needle for node-pre-gyp https download
[sqlite3] Success: "/var/www/vhosts/besthotelguides.com/n8n.besthotelguides.com/node_modules/sqlite3/lib/binding/node-v72-linux-x64/node_sqlite3.node" is installed via remote
npm WARN [email protected] requires a peer of request@^2.34 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of request@^2.34 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

+ [email protected]
updated 1 package and audited 1389 packages in 6.606s

8 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

9.5) Fixing Permession
9.5.1) to see permessions I executed the command : cd /var/www/vhosts/besthotelguides.com/ then the command ls -l and the result is

total 16
drwxr-xr-x 2 kais psacln  4096 Apr 28 21:28 error_docs
drwxr-x--- 3 kais psaserv 4096 Apr 28 21:29 httpdocs
drwx------ 3 kais root    4096 Apr 28 22:21 logs
drwxr-x--- 3 kais psaserv 4096 Apr 28 23:57 n8n.besthotelguides.com

9.5.2) executing the command : chown kais:psacln -R /var/www/vhosts/besthotelguides.com/n8n.besthotelguides.com/
9.5.3) executing the command : chown kais:psaserv /var/www/vhosts/besthotelguides.com/n8n.besthotelguides.com/

10) Adjusting NodeJS Setting From Plesk Panel

The screenshot below showing how I set the configuration and of Environnement variable
I dont know if this correct or no !

11 I disabled the Proxy Mode From the Apache/Nginx Configuration

12 I access to the new subdomain , but the App did not work
I get an erro page , of Phusion Passenger

Also, I back to check the MySQl Database and I find it empty , I dont know if environnement thati set it is valid or no, as well I dont know if I miss other commands or other steps to start n8n or only the Plesk configuration is satisfisant !!

So , Please help me how can I run n8n on a subdomain managed by Plesk Panel.

Thanks in advance .

@jan Can you please help , till now i did not find a solution, I need your help please !

I would love to help you but I have literally no experience with Plesk. In this case, you are not in need of someone who knows n8n (like I do), more someone who knows Plesk. So either you would have to check in a Plesk related forum or hope that another community member here has experience. Sorry!

First of all, welcome to the community, @zmayyem!

So, there is a lot to unpack from your question (Great job on the documentation, BTW! :+1:). You have several pieces of technology at play, any of which could be a part of the issue. Just to summarize the technologies:

  • VPS (Digital Ocean)
  • Plesk Obsidian
  • Debian 9 OS (Digital Ocean preconfigured image/droplet)
  • NodeJS v12.4.0 Plesk installation with a NodeSource installation on top of it
  • Apache (http) and nginx (reverse proxy) and n8n (NodeJS http server) as web services
  • MySQL
  • sqlite
  • n8n 0.64.0 with custom environment variables

Whew! :sweat:

While it is virtually impossible to solve this all in one shot, I can make some suggestions this may assist you with troubleshooting the problem.

  1. Web technologies may be fighting. Since n8n does not really understand virtual hosts (it simply listens on a port), when you go to your n8n site, this information is probably being server up by Apache. I might suggest taking a look at the nginx reverse proxy and see if you can get it to redirect to the n8n site/port. (See Reverse Proxy · Issue #36 · n8n-io/n8n · GitHub, NGINX Reverse Proxy | NGINX Plus, and How to proxy web apps using nginx? · GitHub for further information)
  2. NodeJS may be confused. You start out by installing NodeJS from the Plesk panel and then install a second one from SSH. I’m assuming that both were installed with different credentials since the Plesk application should not be running as root and the Node Source version was installed from the apt package manager which required it to be installed as root. I would suggest using one or the other installation method, not both. Check out Node.js Support | Plesk Obsidian documentation for the proper way to install NodeJS that includes the npm package.
  3. NodeJS global installation permission issues. We have been seeing a lot of issues with NodeJS global installations with n8n running as a different user. The problem generally lies with n8n not being able to access NodeJS folders due to a lack of permissions. Rather than resetting the permissions on the files, NodeJS recommends that you create a new folder in your home folder and point NodeJS there before installing n8n (see Resolving EACCES permissions errors when installing packages globally | npm Docs).
  4. Trying to do too much at once. It is obvious that you have done these type of builds before because you want to get the whole thing done in one shot. But, it may help if you were to try getting n8n running without plesk or just run with command line for a while to see if you can get it up and running that way.
  5. NodeJS may be ignoring your environment variables. Since your environment variables are being entered by Plesk and, as stated previously, NodeJS may be running the Node Source version, NodeJS may be unaware that you have environment variables it should be looking at. I would suggest that you set these environment variables from SSH.
  6. Start with sqlite for a database. To simplify the solution in the short term, use sqlite for the database as there is very little configuration needed to get it going. If it runs from there, then you can look at getting MySQL running.

Best of luck!

1 Like

Plesk can handle easily Docker container, so you can run n8n container with latest version of n8n docker image. (I’m not sure specific version, currently I’m using 0.201.0)

  1. Create specific domain for running n8n on Plesk.
    If not installed Docker extension, install it.

  2. on Plesk Docker menu, search the n8n docker image and run.
    At the running the docker image, need to setting port & volume mapping(/home/node/.n8n Docker - n8n Documentation) and some environment variables(Environment variables - n8n Documentation).
    At least I think below things are needed.

  • N8N_HOST (created by first step)
  • N8N_PROTOCOL
  • WEBHOOK_URL
  1. After container running, You can find docker container on Plesk menu in Domain > {N8N_HOST} > Docker Proxy Rules

Did you achieve it with these steps?

Yes, but I’m not sure if it works with the latest version.
You may need to set additional docker environment variables such as DB or SMTP, in case these are usually managed by plesk