Close Menu
Technoracle
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram
    TechnoracleTechnoracle
    • Home
    • AWS
      • EC2
      • Lightsail
      • RDS
      • S3
    • Ubuntu
      • Ubuntu 20.04
      • Ubuntu 22.04
    • AI Tools
    • Web Hosting
    • WordPress
    • Tech News
    Technoracle
    Home - Ubuntu - How To Install Nginx on Ubuntu 20.04 Easily
    Ubuntu

    How To Install Nginx on Ubuntu 20.04 Easily

    Rajesh ShivamBy Rajesh ShivamJune 4, 2021Updated:June 12, 2023No Comments3 Mins Read
    how to install Nginx on Ubuntu 20.04

    Nginx is a lightweight open-source web server. According to w3tech, Nginx is used by 34.0% of all websites. Many high-traffic websites use Nginx. It is the most popular web server because it is lightweight and works as a reverse proxy server. In this tutorial, I am going to share how to install Nginx on Ubuntu 20.04.

    So, Let’s get started.

    Prerequisites:

    • Ubuntu 20.04(Focal Fossa)
    • A non-root user with sudo privilege.
    • SSH access to the server.

    Page Contents

    Toggle
    • Nginx Installation Steps
      • Step 1: Update Ubuntu Software Repositories
      • Step 2: Installing Nginx
      • Step 3: Checking the Nginx Server Status
      • Step 4: Adjust Nginx Firewall
      • Step 5: Test Nginx Server on the Browser
      • Conclusion

    Nginx Installation Steps

    In this tutorial, I am going to install Nginx on an AWS Ubuntu EC2 instance. Now, Login to the server to continue the installation.

    Step 1: Update Ubuntu Software Repositories

    Before installing any software on the server, it is always recommended to update the software repositories. Update the repositories by following command.

    $ sudo apt update

    Step 2: Installing Nginx

    Nginx comes with default Ubuntu repositories. You can install Nginx on Ubuntu 20.04 by following command.

    $ sudo apt install nginx

    Now, to make sure Nginx is installed correctly, run the following command.

    $ nginx -v

    Output should be something like this

    nginx version: nginx/1.18.0 (Ubuntu)

    Step 3: Checking the Nginx Server Status

    Check Nginx status by following command.

    $ sudo systemctl status nginx

    Output:

    Some Frequently used Nginx commands

    ServicesCommand
    To stop nginx server$ sudo systemctl stop nginx
    To start nginx server$ sudo systemctl start nginx
    To restart nginx server$ sudo systemctl restart nginx
    To reload nginx server$ sudo systemctl reload nginx
    To disable nginx on start$ sudo systemctl disable nginx
    To enable nginx server on startup$ sudo systemctl enable nginx

    Step 4: Adjust Nginx Firewall

    Adjust firewall configuration to all access to the service. Check nginx profile by following command.

    $ sudo ufw app list

    Output should look like

    Available applications:
      Nginx Full
      Nginx HTTP
      Nginx HTTPS
      OpenSSH

    Now, allow access to the Nginx with the default firewall.

    $ sudo ufw allow 'Nginx HTTP'

    System will display “Rule Updated”. Now, reload the firewall by following command.

    $ sudo systemctl reload nginx

    Step 5: Test Nginx Server on the Browser

    Open your favorite browser and hit the server IP, you should see the default nginx page.

    If you haven’t any GUI(Graphical User Interface), you can use curl to check the output.

    $ curl -i 3.138.116.130

    Output should look like this.

    Read Here: How to install LAMP on Ubuntu 20.04

    Conclusion

    In this tutorial, you have learned to install Nginx on Ubuntu 20.04. If you have any doubts feel free to contact me, I will definitely try to help you. Also, you can join our elite Facebook group to get direct help from me. If you like this tutorial, please share this article on your social media handle.

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit
    Previous ArticleHow to Install Zabbix Monitoring Tool on Ubuntu 20.04 Easily
    Next Article How to Attach Static IP to AWS Lightsail Instance Easily
    Rajesh Shivam
    • LinkedIn

    Rajesh Shivam is a seasoned professional with expertise in AWS and Linux System Administration. With over 10 years of freelancing experience, he brings a wealth of knowledge to the table. Rajesh has a strong passion for technology and stays connected with the latest happenings in the field. His dedication and expertise make him a trusted resource for all things tech-related.

    Related Posts

    linux commands every user should know in 2025
    Ubuntu 24.04

    25 Must-Know Linux Commands Every User Should Master in 2025

    Read More
    TeamViewer and Ubuntu logos on gradient background – banner for how to install TeamViewer on Ubuntu 24.04 tutorial
    Ubuntu 24.04

    How to Install TeamViewer on Ubuntu 24.04 [Fast & Easy Steps]

    Read More
    Troubleshooting ‘Permission Denied (publickey)’ SSH error on a Linux server using secure terminal access
    Ubuntu

    Fix ‘Permission Denied (publickey)’ SSH Error on Linux [Step-by-Step Guide]

    Read More
    Add A Comment
    Leave A Reply Cancel Reply

    linux commands every user should know in 2025

    25 Must-Know Linux Commands Every User Should Master in 2025

    April 10, 2025
    TeamViewer and Ubuntu logos on gradient background – banner for how to install TeamViewer on Ubuntu 24.04 tutorial

    How to Install TeamViewer on Ubuntu 24.04 [Fast & Easy Steps]

    April 10, 2025
    Troubleshooting ‘Permission Denied (publickey)’ SSH error on a Linux server using secure terminal access

    Fix ‘Permission Denied (publickey)’ SSH Error on Linux [Step-by-Step Guide]

    April 8, 2025
    Blog banner showing Ubuntu logo, coding laptop, and icons for VS Code, Docker, and Git with the title 'Perfect Dev Setup in Ubuntu 24.04 – Step-by-step guide for developers' on a dark tech-themed background.

    How to Set Up the Perfect Development Environment on Ubuntu 24.04

    April 8, 2025

    Subscribe to Blog

    Enter your email address to subscribe to
    this blog and receive notifications of new posts by email.

    Facebook X (Twitter) Instagram Pinterest
    • Sitemap
    • Privacy Policy
    • Disclaimer
    • Term of Services
    © 2025 Technoracle

    Type above and press Enter to search. Press Esc to cancel.

    Click to Copy