Install Sails.js with Apache as a reverse proxy on CentOS 7

Sails.js on CentOS

In today’s article we will install Sails.js on a CentOS 7 VPS 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.


We will be using our SSD 1 Linux VPS hosting plan for this tutorial.

Log in to your server via SSH:

# ssh [email protected]_ip

Before starting, enter the command below to check whether you have the proper version of CentOS installed on your machine:

# cat /etc/redhat-release

which should give you the underneath output:

CentOS Linux release 7.2.1511 (Core)


Make sure your server is fully up to date:

# yum update

Before installing Sails.js we need to install the Node.js platform. But first, install some much needed tools:

# yum install yum-utils bzip2 bzip2-devel wget curl tar

# yum groupinstall "Development Tools"

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:

# cd /opt

# wget

Unpack the archive:

# tar -xzf node-v0.12.9.tar.gz

Enter the unpacked directory:

# cd node-v0.12.9

Next, configure NodeJS 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:

# ./configure --prefix=/usr/local

Once the configuration is completed, compile and install NodeJS using the following commands:

# make

# make install

After the installation is finished, check the Node.js version with:

# node --version

Which should give you the following output:

# v0.12.9

Now you can install Sails.js. In your command line interface type:

# npm -g install sails

Create a new Sails project:

# cd && sails new yourprojectName

Start the server and make it work in the background using:

# cd yourprojectName && sails lift &

By default the server is listening on

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:

# vim /etc/httpd/conf.d/your_domain.conf

Once the file is opened, paste the below lines:

<VirtualHost *:80>

ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all

ProxyPass /
ProxyPassReverse /
<Location />
Order allow,deny
Allow from all

Don’t forget to replace with your actual domain. Save and close the file. Restart Apache for the changes to take effect:

# service httpd restart

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 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 do any of this 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 please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Install Microweber on Ubuntu 14.04
How to install and configure web2py on CentOS 7
Install Node.js and create your first Express application
There are currently no comments.