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.
- A VPS / Dedicated server with at least 512MB of RAM
- Fresh install of CentOS 6.0 – 6.5 (CentOS 7.0 support coming soon.)
- A dose of Centmin Mod
- Basic knowledge of SSH command
- Basic knowledge to use Putty (Windows) or Terminal (Linux/Mac)
- 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.
Step 1 – Login to your server as root. Use the details (IP address, ssh port and root password) given by your provider.
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:
Step 4 – Now issue this one line command to download and execute Centmin installer:
curl -sL http://centminmod.com/installer.sh | bash
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:
Step 5 – And once done, you’ll see something like this:
If you scroll up a bit, you’ll also see some details like this one:
That’s it. Now you have complete LNMP stack installed and ready to host high-traffic websites.
- Try accessing your server by typing your server’s IP address on browser and you’ll see default Nginx test page:
- 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.
- Add new website on your newly built Nginx server and install the script you want (tutorial is upcoming)
- 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.
- There are two other methods to install Centmin Mod: Traditional SSH shell based menu and CLI command line installs – read more here. So if above method doesn’t work, try another one.
- 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.