Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Web Servers»Nginx»How To Install Nginx on Ubuntu 18.04 & 16.04

    How To Install Nginx on Ubuntu 18.04 & 16.04

    RahulBy RahulMay 26, 20182 Mins ReadUpdated:May 28, 2018

    Nginx is another most popular web server than Apache HTTP Server. It is used by a large number of popular websites worldwide. This web server is highly useful for heavy traffic websites. This tutorial will help you to install Nginx on Ubuntu 18.04 and 16.04 using apt-get.

    1. Prerequisites

    In order to install Nginx on Ubuntu, you must have root or sudo privileged user access to your system. For the remote systems can use ssh command or putty for Windows user to login.

    ssh [email protected]
    

    2. Install Nginx on Ubuntu

    The Nginx latest packages are available under default repositories for all Ubuntu’s versions, You can directly install them by running following commands

    sudo apt-get update
    sudo apt-get install nginx
    

    After installation of Nginx service, run below command to check the status of Nginx service.

    sudo systemctl status nginx
    
    ● nginx.service - A high performance web server and a reverse proxy server
       Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
       Active: active (running) since Fri 2018-04-27 15:38:31 IST; 13min ago
         Docs: man:nginx(8)
      Process: 3406 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
      Process: 3405 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
     Main PID: 3407 (nginx)
        Tasks: 2 (limit: 2323)
       CGroup: /system.slice/nginx.service
               ├─3407 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
               └─3408 nginx: worker process
    

    3. Configure Firewall

    You need to open the firewall port to access Nginx server from remote systems. The following command will allow port 80 (HTTP) and port 443 (HTTPS) on your system.

    sudo ufw allow 'Nginx FULL'
    

    You don’t need to open both ports. Use one of the following commands to open specific ports.

    sudo ufw allow 'Nginx HTTP'
    sudo ufw allow 'Nginx HTTPS'
    

    4. Manage Nginx Service

    The systemd users use systemctl commands to manage their Nginx service on Ubuntu system. The below commands will stop, star, and restart nginx service.

    sudo systemctl stop nginx
    sudo systemctl start nginx
    sudo systemctl restart nginx
    
    nginx nginx on ubuntu nginx web server
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow To Install Docker on Ubuntu 18.04 & 16.04 LTS
    Next Article How to Add Sleep/Wait in Windows Batch Script

    Related Posts

    How To Install Linux, Nginx, MySQL, & PHP (LEMP Stack) on Ubuntu 22.04

    Updated:April 7, 20227 Mins Read

    How to Increase Request Timeout in NGINX

    Updated:January 13, 20222 Mins Read

    How to Install Nginx, MySQL & PHP (LEMP) on Ubuntu 20.04

    5 Mins Read

    How To Install Nginx with PHP-FPM on Ubuntu 20.04

    Updated:December 3, 20203 Mins Read

    How to Install Nginx on Ubuntu 20.04

    3 Mins Read

    How to Configure Nginx for WordPress Permalinks

    Updated:April 21, 20202 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How to run “npm start” through docker
    • Filesystem Hierarchy Structure (FHS) in Linux
    • How to accept user input in Python
    • What is difference between var, let and const in JavaScript?
    • What is CPU? – Definition, Types and Parts
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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