In this tutorial, we will show you how to install Nginx on Ubuntu. For those of you who didn’t know, Nginx is one of the most popular web servers in the world and is responsible for hosting some of the largest and highest-traffic sites on the internet. It is more resource-friendly than Apache in most cases and can be used as a web server or a reverse proxy. So today I’m going to show you how to set up the Nginx web server on Ubuntu or Debian. It’s really not that difficult. Let’s start with Nginx.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you through the step by step installation IonCube Loader on a Ubuntu server. You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian based distribution like Linux Mint.
Install Nginx on Ubuntu
Step 1. To install, first, you must update apt repository and packages by typing the below command:
sudo apt-get install nginx -y
Step 2. Install Nginx,
Installing Nginx is as simple as running just one command:
sudo apt-get install nginx
Starting and stopping the Nginx server
To start the Nginx server, issue the following command:
sudo service nginx start
To stop the Nginx server, issue the following command:
sudo service nginx stop
Configuration Nginx files/folders
- The main configuration file for Nginx is
- Virtual hosts are defined in
- PHP will be configured in
Before you close that terminal window, it’s necessary to set the Nginx service to start at boot. Just issue the following command:
update-rc.d nginx defaults
This should already be enabled by default, so you may see a message like this:
System start/stop links for /etc/init.d/nginx already exist
Navigating to your Server’s IP address (assuming you have no other server listening on port 80), you will be greeted with the standard welcome page:
The steps above should produce a running Nginx which serves the Nginx default pages on port 80. We’ll start working through various configurations and optimizations to round out the series. Enjoy your new webserver! For additional help or useful information, we recommend you to check the official Nginx web site.