Complete Install Nginx Stack Under 15 Minutes On Ubuntu
This will show you how to install Nginx, PHP5 (fpm) with Zend OPCache, MySQL, PHPMyadmin, Postfix (and WordPress) on Ubuntu under 15 minutes. This is possible using EasyEngine tool from RTCamp.
What is Easy Engine? It is a nice little software (linux-shell script) to build a working web server to host your websites on an Ubuntu 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 PHPMyAdmin) so your VPS can act as a webhosting server.
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.
So here comes EasyEngine (ee), a great script to uncomplicate what users think is complicated from Nginx. Shortly, ee is built to simplify the process of installing, configuring and managing Nginx (or full LNMP stack exactly) to host websites on Ubuntu server.
However, you can also read my previous tutorials about building Nginx server on Ubuntu if you wish to learn it from the very beginning.
- A VPS / Dedicated server with at least 256MB of RAM
- Fresh install of Ubuntu (12.04, 12.10, 13.10, 14.04) or Debian 6/7
- A dose of EasyEngine
- Basic knowledge of SSH command
- Basic knowledge to use Putty (Windows) or Terminal (Linux/Mac)
- A cup of coffee.
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 apache2 stop apt-get remove apache2
In this example I removed postfix as well:
Step 3 – Before proceeding, and if you are hesitating about your Ubuntu / Debian version, you can check it using this command syntax:
How to Install EasyEngine
Step 1 – Issue this main command to install EasyEngine on your VPS:
curl -sL rt.cx/ee | sudo bash
It should be finished in seconds:
curl command not found – Issue this command to fix:
apt-get install curl libcurl3 libcurl3-dev
unable to install bc – Issue this command to fix:
apt-get install bc
unable to install Git – Install git using this command:
Basic EasyEngine Configuration
So now you have EasyEngine installed, what next to do -before everything else- is to edit default ee‘s configuration. Use your favorite editor (mine is Nano):
then edit necessary entries:
apt-get-assume-yes = false
Set to “true” if you want to avoid answering confirmation each time new software will be installed.
Set to “true” to fix GPG Key issue so easyengine can try another mirror and fetch the key
htpasswduser & htpasswdpass
leave it blnk if you don’t need it. This part is only needed if you want to password-protect the protected access control area (an area where you can manage easyengine). By default both username and password is easyengine.
You can simply leave it blank if you work / frequently access your server from remote location. You can add your own IP address there to add more security layer by blocking access from IPs other than yours.
Default is localhost but if you changed MYSQL to bind on your VPS IP (other than 127.0.0.1) than you can change it here. Otherwise leave it blank.
easyengine create database automatically for wordpress as well as php/mysql sites where database-name is based on domain name provided. If you like to specify database name manually, set this value to true.
easyengine create a new mysql user automatically for wordpress as well as php/mysql sites where mysql username is based on domain name provided. If you like to specify mysql username manually, set this value to true.
If you want to change WordPress table prefix to something else than wp_, you can provide that string here.
Default value is admin (if you leave it blank), you can change it to any name.
EasyEngine prompts for email address at the time of installation. If you haven’t specified it correctly, you can change it to any valid email address. By default easyegine uses
git config user.email as email address for default WordPress username (see wpadminuser above).
For more detailed information can be found here.
How to Install Nginx, PHP, MySQL, Postfix, phpMyAdmin
It’s time to install the main softwares: Nginx (web server), PHP, MySQL (database server), Postfix (mail server), and phpMyAdmin (database manager) and luckily with ee you can do that in one go using one simple line of command:
ee system install
Sit tight and wait for ee to install the whole LEMP/LNMP stack
In the middle of installation, EasyEngine will ask for HTTP authentication username and password. It is recommended that you specify this to something other than defaults, especially on production server:
Once done, you’ll see something like this:
That’s it. Now you’ve installed complete Nginx stack (including latest version of PHP5 -fpm with ZendOPCache):
You can check status of all running stack packages using following command:
ee system status
What’s next? Creating your first website or setup a working WordPress site using this command:
ee site create example.com --wp