Using NGINX reverse proxy along with the Apache webserver improves the performance of the websites significantly! So, I decided to give it a try. I have configured a lot of webservers earlier with Apache and PHP or Lighttpd and PHP modules. However, I was doing this type of setup for the first time!
I decided to configure a server with Linux – Ubuntu 16.04 LTS, Apache2 as a webserver, NGINX reverse proxy for Apache2, PHP7.0 FPM module for processing server-side PHP scripting, MariaDB server (a community-developed fork of the MySQL), and some other necessary modules to run the server independently. In this article, I will describe the whole procedure that I’ve followed. I will also list all the SSH commands that I’ve used while preparing the server.
Initial Server Setup and Configuration
First of all, I’ve used a 2GB dedicated server with Ubuntu 16.04 LTS version from DigitalOcean to test the setup. After logging in to the server with “root” (or with a sudoer user), first, you have to check if the environment variables are set properly or not. This is to avoid some warnings during other modules installation. Many times, the locales are not set properly by the hosting providers while deploying the server. Therefore, Run the following commands to configure it properly.
sudo locale-gen en_US.UTF-8
sudo dpkg-reconfigure locales