Install the Sails.js framework on an Ubuntu VPS

sailsSails.js is a real-time MVC Framework for Node.js, which makes it easy to build custom, enterprise-grade Node.js apps. 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.

In this blog post we will show you how to install the Sails.js framework on a Ubuntu VPS with Nginx as a reverse proxy.

The following command will install all necessary packages

sudo apt-get update
sudo apt-get install -y python-software-properties python g++ make

Install the the latest version of Nginx

sudo add-apt-repository ppa:nginx/stable
sudo apt-get update && sudo apt-get install nginx

Install the latest version of Nodejs

sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update && sudo apt-get install nodejs

Install the latest stable release of Sails

sudo npm -g install sails

Create a new Sails project

cd && sails new projectName

To start the server, run:

cd projectName && sails lift &

By default the server is listening on 127.0.0.1:1337

Create a new nginx virtual host

vim /etc/nginx/sites-available/your_domain.com
server {
 listen       80;
 server_name  your_domain.com;
   location / {
     proxy_pass        http://localhost:1337/;
     proxy_set_header  Host $host;
     proxy_buffering   off;
   }
 }
 
ln -s /etc/nginx/sites-available/your_domain.com /etc/nginx/sites-enabled/your_domain.com
/etc/init.d/nginx restart

That’s it. Now open your browser and navigate to your domain.

For more info about the Sails.js framework please go to: http://sailsjs.org/#!documentation

Of course you don’t have to do any of this if you use one of our Linux 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.

 

Leave a Comment