How to make a simple ‘Hello everyone’ application using node.js on Plesk Onyx for Windows?
If you want to create a simple application using node.js on Plesk Onynx for Windows then this article will definitely help you. In this article I am going to demonstrate step by step how to create a simple application using node.js on Plesk Onyx for Windows. We have highlighted the differences between Plesk Onynx for Windows and other types of installations.
The article will include following contents:
Step 1: Accessing the Plesk control panel
To access the Plesk control panel, follow these steps:
If you do not know how to log in to the Customer Portal, please follow below steps:
To log in to the Customer Portal, follow these steps:
2. On the Services menu, click MY SERVICES
3. Select the hosting package and to the right of the desired hosting package, click Manage.
4. On the Hosting Information tab, click Open Control Panel.
Step 2: Set up the directory and file
To create the necessary directory and file, follow these steps:
2. Scroll to the management area for the domain where node.js is to be installed, and then click File Manager:
3. On the left side of the file manager is the directory tree. Click Home Directory.
4. On the toolbar at the top of File Manager, click the New list box, and then click Create Directory:
5. In the Create a Directory dialog box, in the Directory name text box, type Hello_ everyone, and then click OK:
6. On the directory tree at the left of File Manager, click the newly created hello_everyone directory:
7. On the toolbar at the top of File Manager, click the New list box, and then click Create File:
8. In the Create a File dialog box, in the File name text box, type app.js, and then click OK:
9. In the right hand pane of the File Manager, click the name of the new file to open it in the code editor:
10. Copy and paste the following code into the editor, then click OK:
const http = require('http');
http.createServer(function(request, response) {
response.writeHead(200, {'Content-Type': 'text/html'});
response.end('<H1> Hello Everyone! </H1>');
}).listen(process.env.PORT);
console.log('App is running…');
Note : – You may notice that this code sample is slightly different from other tutorials. The server.listen command typically names a port number (for example, server.listen(8000);) that starts a server listening for HTTP requests on port 8000. node.js for Windows must use the port provided by the iisnode module for IIS which is specified in the process.env.PORT variable.
Step 3: Configure node.js
To configure node.js and start the application, follow these steps:
2. Scroll to the management area for the domain where you want to install node.js, and then click the node.js icon. The node.js configuration page appears. Errors may appear on the page; they will be fixed in the following steps.
3. On the node.js configuration page, click the name of the Application Root. A directory tree dialog box appears as follows:
4. In the directory tree dialog box, click the Hello_Everyone directory, and then click OK.
5. On the node.js configuration page, click the name of the Document Root. A directory tree dialog box appears as follows:
6. In the directory tree dialog box, click the Hello_Everyone directory, and then click OK.
Note: – You may notice that the Document Root is the same as the Application Root. This is different from other tutorials, where the document root is in a different location and typically contains static files. This is because the iisnode module for IIS consolidates the Document Root and Application Root and uses rewrite rules to direct requests for static files to a specific directory.
Check the Application Startup File setting. It should be set to app.js by default. If it is not set to app.js, click the file name. The Application Startup File dialog box appears.
7. Replace the name in the text box with app.js, and click OK.
8. Click Enable Node.js. A confirmation message will appear. You are now ready to test your first node.js application.
9. Click on the Application URL. A new tab will open and display the Hello Everyone! page.
Visit: Hostripples!
As a web designer and web developer your experience must have reached to new height, right? Further, you need to…
In today's digital landscape, timing is everything. Whether you're a social media manager, business owner, or content creator, the success…
Are you a website owner? Maintaining the website is the prime concern for any website owner. Yes, it’s equally important…
If you’ve planned to launch a WordPress website, you might get a question, “How do I log in to WordPress?”…
As the demand for virtual private servers (VPS) continues to grow, businesses and individuals are faced with a crucial decision:…
View Comments