If you are interested in hosting Node.js apps on your web space, we have good news! The control panel offered by SOD, based on Plesk, is equipped with a Node.js extension that allows you to easily manage applications. In this article we see how it is possible to integrate Node through the control panel.
Host a Node.js application from the Plesk panel
To verify that everything is working, let’s try hosting a Node.js application in the panel. We will use a generic “Hello, World” application. To do this, we will use the Git extension that you find directly from the panel. It would also be possible to upload the application directly to the server, but I thought that implementing a second extension could also be useful for the purposes of this mini guide.
Once you have accessed the SOD Plesk panel, you will need to create a destination folder for the application. Select the “Files” tab, create a “hello-world” folder. From the “Websites & Domains” tab, among the available components, select Git. If you own more than one domain, be sure to select the option under the correct one.
The second screen on where to find the Git icon:
Setting up a local repository
Now let’s set up a local repository as a clone of a remote one to download the code to the folder you created a moment ago. The URL of the repository we will clone is: https://github.com/plesk/node-hello-world.git
To do this, click on the Git icon, set the URL in the space provided and select the “hello-world” folder you created a while ago.
Differences between “Application root” and “Document root” folders
The next step is to change the Document root folder for the domain. Note that the Document root and Application root folders are not the same. When we talk about web apps (such as those based on Node.js), the document root is the position where the static resources are located, while the application root is the root directory where the app. In most cases, the Document root is a folder within the Application root.
Right now we need to change the document root. To do this, go to the “Websites & Domains” panel, select the correct site and go to “Hosting Settings” (right above Git) and click the link:
Change the current “Document root” to hello-world/public.
Enable support for Node.js
Before running the “Hello World” app, the last thing you need to do is enable support for Node.js on the domain. Then go to the “Websites & Domain” panel and click on the appropriate option. Here you can see some information about the app. Click on “Enable Node.js” and in a few moments this will be enabled.
At this point, if everything went well, clicking on the “Application URL” you should see a screen that says “Hello World!”. Congratulations, you have just installed and run an app on your domain.
Applications with dependencies
Applications built with Node.js, more often than not, must satisfy dependencies that are defined in the package.json file, which is installed in the “node_modules” directory.
Let’s look at another ExpressJS-based application. You can find it in its repository, upload it manually, or repeat the steps described in the previous section. Here is the repository: https://github.com/plesk/node-express.git. Once you have things sorted out, you will find yourself as in the screenshot below, assuming you have cloned the repository in the express-demo folder:
Install the dependencies and change the startup file
Before trying to access the app, you need to initialize it. Let’s start by installing the dependencies. Fortunately, in the Plesk panel of SOD, there is a simple “NPM install” button. This is done to install app dependencies based on the “package.json” file. Install the dependencies this way, for convenience.
Finally, we need to set up the app’s startup file. Plesk uses the Phusion Passenger server application to service the Node.js apps. In the demonstration repository, there is a file called “server.js”. This, which is not a common part of ExpressJS-based apps, contains a few lines of code necessary to make the app work:
const app = require (‘./ app’);
const http = require (‘http’);
http.createServer (app) .listen (process.env.PORT);
You can use the idea behind this file when hosting other Node.js applications, for example based on a different framework. The last thing you have to do is change the “Application Startup File” option and set it to “server.js”.
At this point, browsing to the address that hosts the app, you should see the ExpressJS welcome screen.
For every Node.js developer it is essential to know how to identify problems to find a solution. To do this, here are a couple of tips that might help you Debug.
Checking the log file
The first thing to do when debugging a Node.js application is to check the log files. For example, if you forget to install the dependencies for the Express demo app, the server error log will contain the error “cannot find module ‘express'”. Unfortunately, due to how Phusion Passenger works, server level error logs are used instead of per domain error logs. In this case, end users will see a simple generic error message.
To check the server log messages, go to the “Websites & Domain” panel, under the domain concerned, look for the log option. Clicking on it will give you access to a screen of the logged messages.
See messages directly on the app screen
It can be very useful to see the error messages directly on the app website, without looking for the option in the control panel. Go to the Node.js app settings screen and change the application mode to “development”. The next time a problem occurs, the error will be shown in the browser window.
Furthermore, if the app is in “development” mode, it is not necessary to restart the app every time you change the contents of a file.
As we have seen, implementing Node.js applications on your domain is really simple with the Plesk control panel of the SOD hosting service, which is once again very flexible, intuitive and easy to use.
If you want to try this and other features, you can test the demo version by simply clicking here.
Most hosting environments use an intuitive interface to help users manage their web spaces. Two very famous panels are cPanel and Plesk, widely used and offered in the SaaS formula. Without these graphical interfaces, it would be difficult to manage a hosting space and set up a site. A lot of time is usually spent managing a web space through a control panel, consequently, the choice of a provider should also be made based on the panel it offers, how user friendly it is and what features are immediately available.
Let’s see what are the generic advantages of a web panel and try to understand why the use of a product like Plesk is to be preferred.
Why use a web panel?
A web panel is essentially a hosting management tool. It allows you to do things like organize site files, manage installed applications, email and much more. Providers offer a panel to help their customers effectively manage their sites. Without such a dashboard, managing a web portal and server would be much more complicated and would require a lot of additional skills.
The great advantage of control panels is that they allow users to set up and manage complicated processes with the click of a button.
Some things that can be done simply with a click: install a CMS, generate a subdomain, install software on the server and much more. All this is just the tip of the iceberg of what a panel like cPanel or Plesk can do.
Common features of web panels
Regardless of which web panel you end up using, you will likely have access to a similar set of functions. Below we take a look at what these features are.
DNS is the acronym for domain name management system. Most web panels provide the tools you need to manage domains, connect them to an existing site, redirect domains, and much more.
File and database management
These features allow you to manage the files of your web space through the cPanel and Plesk panels. With the management via FTP it will be possible to access the single files of the site, in some cases directly from the panel, and to modify them as desired. The database management offers the same editing function for the tables and the data contained within it. It may not be necessary to use these features often, but they are essential to have full control of your site.
Having an email address associated with the domain name helps the site look professional. With the e-mail management functions you are able to set a specific e-mail address for the domain, send and receive e-mails and other operations related to messaging.
The backup of the web portal is incredibly important for the security of your data. it is a great way to help mitigate risks in case the site is hacked, or if there is a problem blocking the site. With a regular backup system, it is easy to restore a previous version of the site in case of need.
Installation of applications and software
Most control panels have various software and applications that can be installed with just one click. One of the most common uses is to allow you to install popular software like Joomla !, or WordPress, with the click of a button.
Why choose cPanel or Plesk
If it is true that web panels often offer similar functionalities, the solutions to offer a user interface to their customers are different and can be divided into two broad categories: providers who rely on services such as cPanel or Plesk, and those who instead use a customized panel with all the resulting risks.
The choice of a control panel developed by companies specialized in the service is a safety in terms of stability, support and potential. Products like the ones we are about to describe have years of experience behind them, large communities and many users who can guarantee that every problem is identified and solved in the shortest possible time.
These obvious benefits are not available on custom web panels or developed directly by service providers to save money. When it comes to the security and stability of your site, don’t take any chances.
it is one of the most popular panels and one of the most used, although only available for Linux servers. Its features include both an interface for the end user and one for managing the server via WHM. It is also possible to expand its functionality with additional packages.
cPanel is one of the most popular web panels available today. With its wide variety of features, intuitive interface and extensive customization options it has been designed to meet a broad spectrum of hosting needs.
Plesk is available for both Linux and Windows environments. it is one of the easiest to use control panels available for the Windows hosting environment. It offers a very clean user interface and multiple product options to suit different hosting environments. It also allows the management of access by the end user.
Its intuitive graphical interface is designed to eliminate the hard work of managing the host. It offers a suite of tools to improve the security of your site and the development environment in general. A variety of different automation tools are also available, so you can focus on your own websites and not on infrastructure maintenance.
Online hosting is the process of using space on a remote server to host a website. The content of the pages (HTML, CSS, images, etc.) must be loaded into the server space to be reached online.
Website hosting service providers have servers, connectivity and associated services for hosting online pages. By offering a variety of plans for online hosting, they cover a wide range of needs: from small blogs to large organizations.
Choosing the online hosting plan means selecting the right resource allocation to keep the portal fast and reliable for visitors. If there is a problem while browsing a site, for example it takes too long to load, potential customers will probably leave.
Online hosting and site domain
The first thing to do to open a web space is to buy a domain. Often providers also offer the sale and management of domains, as well as online hosting. The service provider ensures that when users search for the domain on the network, they are directed to the server hosting the linked site.
Choose hosting for a website
Selecting the appropriate online hosting plan is an important step for online presence, especially if you are launching a corporate website. Providers also offer server management services, but also software, support, bandwidth and speed.
Always keep in mind when choosing an online hosting plan: nothing is free. What seems free often has a non-economic cost.
Website Hosting – The Importance of Bandwidth
Bandwidth (sometimes referred to as “traffic” or “data transfer”) is the number of bytes needed to transfer the site to visitors. A rough example of a site’s typical traffic requirements: most portals that don’t provide video or music use less than 3 gigabytes of bandwidth per month.
If you are expecting a rapid expansion or need to use audio and video on the site, you should consider purchasing a plan that offers extra space. Free hosting for the website is not recommended, because daily or monthly limits are usually imposed on the amount of usable traffic.
Evaluate expansion options
Most new sites start with shared online hosting spaces, which are quite powerful nowadays. However, if the site is expected to grow over the years, it will be necessary to consider the use of greater resources, or even a more powerful server, a VPS (Virtual Private Server) or VDS (Virtual Dedicated Server), for example .
Providing plans that offer more resources from the provider will save time and money by avoiding a migration to other suppliers.
Reliability is extremely important for this type of service. Real reliability is present only with a paid online hosting plan. A website should work 24/7, and the guarantee that this will only happen with reliable providers and stable network connections.
A site that is difficult to reach or that is often out of order, loses visitors and customers. This negatively affects the authority of the domain. Furthermore, an unavailable site prompts you to visit that of the competition. Bandwidth is also very frustrating and similarly affects users.
Website Hosting – The Control Panel (Plesk)
The purpose of a panel is to allow the management of the various aspects of the account for hosting the website. It is normally offered by each commercial host to carry out normal maintenance operations without having to request technical intervention. A Plesk also provides a simple dashboard to manage email addresses, account passwords and basic server configurations.
If you also want to host e-mail accounts together with the website, you must check that the online hosting plan provides for the setting of e-mail addresses linked to the domain. it is unprofessional to have an unassociated email address. Does an address like [email protected] or [email protected] seem more authoritative?
Choosing the right provider and the right online hosting plan for your site is not easy, many factors come into the day. It is certainly important to think about it before starting a project and take the right time to evaluate the options available. This will save time and money in the future.
SOD offers several quality web hosting plans, suitable for various situations and needs. The service is hosted on the Linux platform, which is by far the most adopted and secure server solution in the world. Check the rating on Google for further quality assurance of the service offered!
Security Awareness, la sicurezza aziendale parte dai dipendenti. L'ingegneria sociale fa spesso leva sull'ignoranza… https://t.co/nGAs70Ofn5
Torna all'inizio Scopri i nostri servizi di Cyber SecurityTroverai sicuramente quello che fa al caso tuo Se vuoi m… https://t.co/Emm5kUfFc4
Estimated reading time: 6 minutes Today we see one of the latest additions to our SOCaaS, the Autonomous Threat… https://t.co/QNvHnKbEqq
Estimated reading time: 6 minutes The Security Code Review (SCR) service is increasingly used by companies l… https://t.co/rJmYXr1oCj
Estimated reading time: 6 minutes Il servizio di Security Code Review (SCR) è sempre più utilizzato dalle aziende… https://t.co/g2ho2C8FYh