How To: Windows Plesk and NodeJS

Hello All,

After spending sometime today setting up my Plesk Server for staging, I’ve run into some issues. I got it to work on Windows 2022, here is how:

This setup is strictly for Windows Plesk Server:

We will use “httpdocs” to host our app.

  1. Inside of Wappler targets ftp setup remote Directory:

image

  1. Go into “Websites & Domains” > “Hosting Settings” and ensure that “Document Root” is equals to httpdocs

image

  1. Go into Node.js settings and ensure that BOTH “Document Root” and “Application Root” are pointing to /httpdocs . They should be the same. (I know, I know… Wappler docs said differently, but this is for Windows and Plesk docs said this is the way for Windows)

image

  1. Using file manager’s “Change Permissions” ensure that “Application pool group” has all permissions on /httpdocs directory. This is required for when we run build inside httpdocs

  1. Create a file called web.config inside /httpdocs
    <configuration> <system.webServer> <rewrite> <rules> <rule name=“server“> <match url=“/*“ /> <action type=“Rewrite“ url=“index.js“ /> </rule> </rules> </rewrite> </system.webServer> </configuration>
1 Like

No matter if Windows, Linux, Unix, Android, iOS or ChromeOS, the Document Root is the public folder. In your case this should read /httpdocs/public. The Startup File for Wappler produced sites is index.js.

As a side note, there is no need to host from the httpdocs folder, you can create a folder named anything to your liking and host from there. I have called mine app

As you can see from the above image, I have also hosted a Node project from a folder called kevi.......

I hope this helps.

Edit: I see that you have also created a web.config file. This is a way to manipulate the IIS server which Node will ignore. Node uses its own server.

@ben

I tested your method above, and it doesn’t work on Windows running Plesk Obsidian. Works on my Linux running Plesk Obsidian. If you do a quick search on this forum everyone that’s having issue is hosting on windows plesk server it’s because of Document Root and App Root path.

My post above works 100% on my Windows server.

Here is Plesk docs: https://www.plesk.com/kb/support/how-to-install-and-run-node-js-application-via-plesk/amp/

In Plesk for Windows: the Application Root directory must be same as the Document Root directory.

1 Like

Thanks for the feedback. Another lesson learnt. Goes to show that no one is too old to learn.

My apologies for the mis-information. :blush:

Maybe this will help:

@George this post is to help anyone who needs help setting it up on Windows Plesk Server.

It’s just a simple guide, you may edit it if you see anyhthing wrong with it.

Thanks

2 Likes

@krish thank you for posting this - I spent a full day working on this install yesterday and was about to give up. Your instructions are indeed the only way to set up NodeJS on a Windows server running Obsidian. Its a strange set up indeed, but it works perfectly. It was the folder permissions bit that is crucial as without that the errors generated are a but difficult (for me anyway) to pin down.

The only thing I can add would be for anyone running Windows server with PLESK Obsidian is to also make sure you have URL Rewrite installed in the IIS Manager under the website being used. For anyone else that needs it theres easy step by step info here:

I dont know which part of the world you are in @krish but if we ever meet I owe you a (very large) coffee/beer of your choice - thanks again for posting :slight_smile:

You are most welcome :slight_smile:

I’ll take a virtual beer, lol.

1 Like

I’ve tried various solutions, but unfortunately none of them work
I am very disappointed