To install Nginx on Ubuntu, follow these general steps:
- Open a terminal window on your Ubuntu system.
- Update the apt package index by running the following command:
sql
sudo apt update
- Install Nginx by running the following command:
sudo apt install nginx
- After the installation is complete, start the Nginx service by running the following command:
sql
sudo systemctl start nginx
- To check if Nginx is running, run the following command:
lua
sudo systemctl status nginx
If Nginx is running, you should see a message that says “active (running)”.
- By default, Nginx should start automatically when your system boots up. If it doesn’t, you can enable the Nginx service to start on boot by running the following command:
bash
sudo systemctl enable nginx
Now that Nginx is installed and running, you can access the default Nginx web page by opening a web browser and navigating to your server’s IP address. If everything is working correctly, you should see the default Nginx web page.