Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Web Servers»Nginx»How To Install Nginx on Ubuntu 18.04 & 16.04

    How To Install Nginx on Ubuntu 18.04 & 16.04

    By RahulMay 28, 20182 Mins Read

    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.

    Advertisement

    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

    Related Posts

    How To Set Up Nginx Reverse Proxy: A Step-By-Step Tutorial

    Configuring the Nginx Reverse Proxy in Front of Apache

    Configure CORS in NGINX

    How to Enable CORS in Nginx

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to Split Large Archives in Linux using the Command Line
    • System.out.println() Method in Java: A Beginner’s Guide
    • Split Command in Linux With Examples (Split Large Files)
    • Test Your Internet Speed from the Linux Terminal
    • 11 Practical Example of cat Command in Linux
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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