First, open the terminal by pressing
Ctrl+Alt+T
on your keyboard.Update the package list using the following command:
1
sudo apt-get update
Install Nginx using the following command:
1
sudo apt-get install nginx
Once the installation is complete, start the Nginx service using the following command:
1
sudo systemctl start nginx
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.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: