Install Nginx (CentOS) - wollardj/Mandrill GitHub Wiki

Previous: Install NodeJS


Nginx is a very attractive web server which is widely recommended for use with NodeJS applications. But, there are lots of other reasons why you might want to use Nginx, even for web applications other than Mandrill. Perhaps it's obvious, but Nginx is well suited for high-traffic environments such as your Munki repository.

The npm module pm2, is a process manager for NodeJS applications. Requests come in through Nginx and are proxied to a pm2 daemon, Mandrill in this case.

Add The Nginx Repo

Create a new file /etc/yum.repos.d/nginx.repo and add the following contents:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

If you're using REHL, use http://nginx.org/packages/rhel/$releasever/$basearch/ for the baseurl.

Install Nginx

sudo yum install nginx

Install pm2

If the commands below complain about not being able to find npm or pm2, read this.

sudo npm install -g pm2

# install startup scripts to make sure pm2 and all its daemons
# respawn when the server reboots.
pm2 startup centos

Next: Configure pm2