Recommended VPS Complete list of best VPS hosting providers.

Complete Install Nginx Stack Under 15 Minutes On CentOS

It’s been a while for me not updating this blog due several offline tasks. In today’s post I’ll show you how to build a working CentOS VPS to host websites using Nginx including steps how to install  full LNMP stack under 15 minutes, including MariaDB MySQL, PHP5 and CSF Firewall. This is just a short method guide for CentOS of my previous article: How to install complete Nginx stack on Ubuntu under 15 minutes.

Enough the chit chat part. This guide will make use of Centmin Mod, a LEMP (Linux, Nginx, MariaDB MySQL & PHP-FPM) web stack installer for CentOS Linux.

What is Nginx? Nginx is a better free alternative to Apache because its lightweight and RAM-friendly. It can perform better and faster than Apache, particularly when the number of concurrent site visitors is on the rise. The only downside of Nginx is that not many users familiar with Nginx because it has different DNA and anatomy compared to Apache. For instance, Nginx doesn’t support Apache’s .htaccess so users need to convert their htaccess content to nginx configuration.

What is Centmin Mod? It is a nice little software (linux-shell script) to build a working web server to host your websites on a CentOS VPS (or Dedi server). The script will install complete LEMP / LNMP stack (Linux, Nginx, MySQL and PHP) along with all necessary softwares (like Postfix and CSF) so your VPS can act as a webhosting server. Currently it supports up to CentOS 6.5 while its CentOS 7-version is still working in progress. You can read more about Centmin Mod here.

Requirements

You’ll need:

  1. A VPS / Dedicated server with at least 512MB of RAM
  2. Fresh install of CentOS 6.0 – 6.5 (CentOS 7.0 support coming soon.)
  3. A dose of Centmin Mod
  4. Basic knowledge of SSH command
  5. Basic knowledge to use Putty (Windows) or Terminal (Linux/Mac)
  6. A cup of coffee.

In this example I use CentOS 6.5 VPS with 768MB of RAM from Vultr. Need recommended VPS? Try checking out my list of recommended VPS or this 15+ top low end cloud vps providers.

vultr-box-spec

Preparation

Step 1 – Login to your server as root. Use the details (IP address, ssh port and root password) given by your provider.

centmin-1

Step 2 – Check if Apache is already installed and running. If so, stop it (or remove it):

service httpd stop
yum remove httpd -y

Step 3 – Now move to this directory:

cd /usr/local/src

Step 4 – Now issue this one line command to download and execute Centmin installer:

curl -sL http://centminmod.com/installer.sh | bash

pic:

centmin-2

The process will take a bit long time so you can grab a cup of coffee (or tea) while paying attention to your screen which somehow displaying installed packages:

centmin-3

Step 5 – And once done, you’ll see something like this:

centmin-4

If you scroll up a bit, you’ll also see some details like this one:

centmin-5

That’s it. Now you have complete LNMP stack installed and ready to host high-traffic websites.

Post Install

  1. Try accessing your server by typing your server’s IP address on browser and you’ll see default Nginx test page:
    nginx-testpage-centminmod
  2. You can also check which version of Nginx, PHP and MariaDB is installed. If you want newer version, then you can use ./centmin.sh menu to upgrade.
    nginx-stack-version
  3. Add new website on your newly built Nginx server and install the script you want (tutorial is upcoming)
  4. If you use reverse proxy or proxy service such as Cloudflare, Incapsula, Google PageSpeed Service, Varnish Cache in front of Nginx web server. You need to properly setup Nginx via HttpRealIpModule. You can find guide link on Nginx Configuration page or directly here.

General Notes

  1. There are two other methods to install Centmin Mod: Traditional SSH shell based menu and CLI command line installsread more here. So if above method doesn’t work, try another one.
  2. For Xen 32bit Paravirtulized OS users on 64bit host nodes prior to install if on Xen VPS, you need to enable and uncomment one variable (remove hash # in front of the variable) ARCH_OVERRIDE=’386′ within centmin.sh then install via centmin.sh for Centmin Mod to work.

That’s it. Do not forget to follow me on twitter or download Servermom’s official Android app to get faster update as well as great news of vps deals.

7 Comments

Add a Comment

Your email address will not be published. Required fields are marked *

Get more stuff like this
in your inbox

Subscribe and get interesting stuff plus faster updates to your email.