We’ll show you, how to install Sails.js on CentOS 7, with Apache configured as a reverse proxy. Sails.js is a Javascript framework designed to emulate the familiar MVC pattern of frameworks like Ruby on Rails, but with support for the requirements of modern apps:
data-driven APIs with a scalable, service-oriented architecture.
Sails.js is database agnostic, automatically generates a RESTful JSON API for your app, provides basic security and role-based access control by default, has automatic asset minification and many more.
It’s especially good for building chat, real time dashboards, or multiplayer games; but you can use it for any web application project – top to bottom.
REQUIREMENTS
We will be using our SSD 1 Linux VPS hosting plan for this tutorial.
Table of Contents
1. Log in to your server via SSH:
Before starting, enter the command below to check whether you have the proper version of CentOS installed on your machine:
which should give you the underneath output:
2. Update the system
Make sure your server is fully up to date:
3. Install the Node.js platform
Before installing Sails.js we need to install the Node.js platform. But first, install some much needed tools:
4. Download Node.js
Once the install is completed, navigate to your server /opt directory and download the latest (at the time of writing this tutorial) Node.js version with the below two commands:
Unpack the archive:
Enter the unpacked directory:
5. Configure Node.js
Next, configure Node.js sources by setting the –prefix flag to /usr/local, so that NodeJS will be installed in this location and will be usable to all users on the Linux VPS:
5. Compile and install Node.js
Once the configuration is completed, compile and install Node.js using the following commands:
After the installation is finished, check the Node.js version with:
Which should give you the following output:
6. Install Sails.js
Now you can install Sails.js. In your command line interface type:
7. Create a new Sails project:
8. Start and configure Sailis
Start the server and make it work in the background using:
By default the server is listening on 127.0.0.1:1337
8. Configure Apache as a reverse proxy
Last but not least you need to configure Apache as a reverse proxy for your domain. With your favorite text editor open a new file. We are using vim:
Once the file is opened, paste the below lines:
9. Restart Apache web server
Don’t forget to replace your_domain.com with your actual domain. Save and close the file. Restart Apache for the changes to take effect:
Congratulations, you have successfully installed Sails.js and configured Apache as a reverse proxy.
Your next step is to open your favorite web browser and navigate to http://your_domain.com where you will be welcomed by a page as shown in the picture below:
For more info about the Sails.js framework please go to their official documentation.
Of course you don’t have to Install Sails.js on CentOS 7, if you use one of our CentOS Optimized VPS Hosting services, in which case you can simply ask our expert Linux admins to install this for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post, on how to Install Sails.js on CentOS 7, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.
Thank you for providing the step-by-step information of install Sails.js on CentOS 7. It is very useful and helps developers to install on their system. My appreciation to you. Keep posting.