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.
Requirements
You’ll need:
- 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.
In this example I use Ubuntu 14.04 VPS with 512MB of RAM from XVMLabs. Need recommended VPS? Try checking out my list of recommended VPS or this 15+ top low end cloud vps providers.
Preparation
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
pic:
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:
cat /etc/*-release
output example:
How to Install EasyEngine
Step 1 – Issue this main command to install EasyEngine on your VPS:
curl -sL rt.cx/ee | sudo bash
edit: the install command has changed. Use:
wget -qO ee rt.cx/ee && sudo bash ee
It should be finished in seconds:
common problems:
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):
nano /etc/easyengine/ee.conf
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.
gpg-keys-fix= false
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.
ip_address
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.
mysqlhost
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.
customdbname
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.
customdbuser
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.
wpdbprefix
If you want to change WordPress table prefix to something else than wp_, you can provide that string here.
wpadminuser
Default value is admin (if you leave it blank), you can change it to any name.
wpadminemail
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.
Example:
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
pic:
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
Sample output:
What’s next? Creating your first website or setup a working WordPress site using this command:
ee site create example.com --wp
I will cover (with example) about that later in the next post Read: How to install WordPress under 5 minutes via EasyEngine. So, stay tuned! Do not forget to follow me on twitter @servermomdotcom or download my official Android app.
Thank you for this article.
Is there a similar program on CentOS
thank you
You can try Centmin or this Nginx Auto Installer Script.
Hi Sawiyati,
This is Avadhoot from EasyEngine team. Thanks for covering EasyEngine. 🙂 Really great.
Stay tuned with us for updates: https://rtcamp.com/subscribe/?newsletter-topic=nginx
or on twitter: @easyengine. 🙂
Thanks,
-Avadhoot
It is an honor for me you are visiting my blog :). thanks
Thanks for the tutorial . Would love to see more tutorial on how to move wordpress site from apache to ningx using backupbuddy plugin or manually ….. Also how to manage ningx & tweak everything using easyengine in detail ….
Thanks for covering this script on your site . Love it !!!
Git fix: for “Unable to Git commit on /etc/nginx/”
git config –global user.email “you@example.com”
git config –global user.name “Your Name”
Hi Sawiyati,
Thanks for putting up this great article, I would like to know, If I want to host multiple WordPress websites on a single server, how do I go ahead.
Do I need to repeat all the instructions in this article http://servermom.wpengine.com/install-nginx-ubunt/1635/ and this article http://servermom.wpengine.com/wordpress-nginx-easyengine/1678/ or do I just need to repeat the steps mentioned in this article http://servermom.wpengine.com/wordpress-nginx-easyengine/1678/
Thanks in Advance !
EasyEngine is using a different folder map
the EE root is now in “/etc/ee” and the system is no longer an argument to EE cli. Use ee stack install –all or replace all with module of your choice. For full reference see. http://docs.rtcamp.com/easyengine/commands/stack
Thanks for the tip dude 🙂
Hi, i think EasyEngine just got updated, the command above (to install EasyEngine) doesn’t work anymore because they ask for email now. (Which is bypassed when using curl, that makes the installation to fail)
I went through their website and found this command
“wget -qO ee rt.cx/ee && sudo bash ee”
thanks for the tip, I’ll update the article soon
Many of the commands are outdated in this article. I was able to google/find new commands but a beginner might get stuck and confused. Please update the article so its easier for the next person. Thanks!
As a beginner I was extremely confused about setting servers and all. Also I was much concerned about security. Somehow I ended up taking this course based on easyengine on Udemy.
https://www.udemy.com/a-complete-guide-to-install-wordpress-php-on-cloud-server-aws-or-vps/