How to install Nginx server on Ubuntu?

  1. First, open the terminal by pressing Ctrl+Alt+T on your keyboard.

  2. Update the package list using the following command:

    1
    sudo apt-get update
  3. Install Nginx using the following command:

    1
    sudo apt-get install nginx
  4. Once the installation is complete, start the Nginx service using the following command:

    1
    sudo systemctl start nginx
  5. Verify that Nginx is running by entering the server’s IP address or http://localhost in your web browser. You should see the Nginx default landing page.

  6. If you want to make sure that Nginx starts automatically at boot time, run the following command:

    1
    sudo systemctl enable nginx

Congratulations! You’ve successfully installed Nginx on Ubuntu.

Here’s an example of what the default landing page looks like when you navigate to the IP address of your server in a web browser:

nginx_default_page