Saturday, May 13, 2017

How to install Nginx on Lubuntu 16.04

How to install Nginx on Lubuntu 16.04

Nginx (engine x) is a high performance web server and a reverse proxy server, the difference with apache web server is that nginx is more focus on performance (speed). In this article i will show you how to install nginx web server on lubuntu 16.04.

Before we begin the tutorial, just make sure you understand that you can't have the same program using the same port. Therefore if you currently have an apache web server running on your machine, it cannot be using the same port as nginx.

By default both apache and nginx are using port 80 as the default port, yes you can have two web server running on your lubuntu but they need to be on different port. So either change default port for apache or nginx if you want both web server running.

Anyway, if you want to stop the apache web server service you can use the command below:
sudo service apache2 stop
If you want to get rid of apache and switch to nginx completely, you can uninstall apache using this command:
sudo apt-get purge apache2
sudo apt-get autoremove


Step by step how to install Nginx on lubuntu 16.04
  • open command line (press CTRL + ALT + T)
  • run this command to install nginx
  • sudo apt-get install nginx
  • the default port of nginx is same as apache web server which is port 80 (you can change this in the configuration file)
  • the default root directory of nginx is same as apache web server (you can change this in the configuration file)
  • /var/www/html/
  • the configuration file for nginx is located at
  • /etc/nginx/sites-enabled/default



How to start, stop, restart and check status of Nginx
  • stop nginx service
  • sudo service nginx stop
  • start nginx service
  • sudo service nginx start
  • restart nginx service
  • sudo service nginx restart
  • check the status of nginx service
  • sudo service nginx status


No comments:

Post a Comment