Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Open terminal in Ubuntu

  2. TYPE the following commands

    Code Block
    $ sudo su 
    $ [sudo] password for 'username': 
    # once you've entered your password you will have root permissions 
  3. Installing Nginx

    Code Block
    $ sudo apt update
    $ sudo apt install nginx
    #After accepting the procedure, apt will install Nginx and any required dependencies to your server.
  4. Adjusting the Firewall

    Code Block
    $ sudo ufw app list
    #You should get a listing of the application profiles:
    
    output:
    Available applications:
      Nginx Full
      Nginx HTTP
      Nginx HTTPS
      OpenSSH
    # Nginx HTTP: This profile opens only port 80 (normal, unencrypted web traffic). You need to enable this
     
    $ sudo ufw allow 'Nginx HTTP'
    #You can verify by typing 
    $ sudo ufw status
    
    output:
    Status: active
    
    To                         Action      From
    --                         ------      ----
    OpenSSH                    ALLOW       Anywhere                  
    Nginx HTTP                 ALLOW       Anywhere                  
    OpenSSH (v6)               ALLOW       Anywhere (v6)             
    Nginx HTTP (v6)            ALLOW       Anywhere (v6)
    
    #You should see HTTP traffic allowed in the displayed output
  5. Checking for webserver

    Code Block
    $ systemctl status nginx
    
    output: 
    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 Wed 2020-02-12 11:14:27 CET; 30 min ago
         Docs: man:nginx(8)
     Main PID: 2369 (nginx)
        Tasks: 2 (limit: 1153)
       CGroup: /system.slice/nginx.service
               ├─2369 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
               └─2380 nginx: worker process
            
    #The service appears to have started successfull. You can access the default page Nginx landing page to confirm that the software is running properly by navigating to your server’s IP address. 
  6. Enter your server IP address

    Code Block
    $ curl -4 icanhazip.com 
    
    ifconfig
    
    #This will give your IP 

    When you have your server’s IP address, enter it into your browser’s address bar:

    Code Block
    http://your_server_ip or localhost 

This should display the default Nginx landing page

...