Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Linux Distributions»Debian»How To Install Nginx on Debian 9 (Stretch)

    How To Install Nginx on Debian 9 (Stretch)

    By RahulApril 30, 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 Debian 9 Stretch using apt-get.

    Advertisement

    1. Prerequisites

    To install Nginx on Debian 9, 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 Debian 9

    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 Mon 2018-04-30 03:54:27 UTC; 2s ago
         Docs: man:nginx(8)
      Process: 5396 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
      Process: 5394 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
     Main PID: 5398 (nginx)
        Tasks: 2 (limit: 4915)
       CGroup: /system.slice/nginx.service
               ├─5398 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
               └─5399 nginx: worker process
    

    3. Configure Firewall

    Most probably you are using IPTABLES for Debian system. The following command will allow port 80 (HTTP).

    sudo iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
    

    You can use the same for port 443 (HTTPS). If you somehow used ufw firewall use following:

    sudo ufw allow 80/tcp
    

    4. Manage Nginx Service

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

    sudo systemctl stop nginx
    sudo systemctl start nginx
    sudo systemctl restart nginx
    

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to Setup DKIM (DomainKeys) with Postfix

    A Step-by-Step Guide to Installing OpenDKIM with Postfix on Ubuntu – Unleash the Power of DKIM!

    Create a Sudo User on Debian

    How to Create a Sudo User in Debian

    How to Install XRDP Server on Debian

    How To Install XRDP (Remote Desktop) on Debian 10

    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.