How to Setup Nginx on Linux


Nginx is a high-performance HTTP, free and open-source reverse proxy server and is pronounced as “engine x”. In comparison to the Apache web server, Nginx can handle a much large number of concurrent connections and has a smaller memory per connection. Nginx is used to host the largest and high traffic sites on the internet. Nginx is one of the most popular webs or reverses proxy servers as it is more resource-friendly than Apache in most cases. Nginx has many usages other than a reverse proxy that is mail proxy, HTTP cache, and load balancing.

In this tutorial, we will discuss how to install Nginx on Ubuntu 18.04.


  • Ubuntu 18.04 server up and running.
  • A non-root user with sudo privileges.

Installing Nginx

  • Update the packages
  • Install Nginx
  • Verify the version of Nginx 

Firewall Setting

  • Open HTTP (80) and HTTPS (443) ports by allowing the ‘Nginx Full’ profile.​​​​​​​

List the profiles available

  • You will get the list of application profiles
  • Allow Nginx Full
  • Verify firewall status
  • The output of above command will be

Testing the Installation on browser

  • Verify the service of Nginx, it should be running
  • Enter the URL e.g. http://YOUR_IP_ADDRESS in your browser

Managing the Nginx service with systemctl

  • To stop the Nginx service
  • To start the Nginx service
  • To restart the Nginx service
  • Whenever you have made some changes to the configuration then reload the changes to reflect it.
  • To disable the Nginx service on booting
  • To Re-enable the Nginx service on booting
  • To Test the configuration if it is correct or not


  • You are now ready to use Nginx as a web or reverse proxy server, deploy your applications on the server and now you have many options to serve the different types of content and the technologies to create a richer experience.

Related Posts


How to Setup Nginx on Linux

Contents Introduction Prerequisites Installing Nginx Firewall Setting Testing the Installation on browser Managing the Nginx service with systemctl Conclusion Introduction...

Read More