To install Nginx on a Linux system, you can follow these steps:
-
Update package lists: First, update the package lists to ensure you have the latest information about available packages:
sudo apt-get update -
Install Nginx: Use the following command to install Nginx:
sudo apt-get install nginx -
Check if Nginx is installed successfully: After the installation, you can verify that Nginx is installed by checking its version:
nginx -vYou should see output similar to:
nginx version: nginx/1.18.0 -
Start Nginx: If Nginx is not already running, you can start it with:
sudo systemctl start nginx -
Enable Nginx to start on boot: To ensure that Nginx starts automatically when the server boots, use:
sudo systemctl enable nginx -
Verify Nginx is running: You can check the status of Nginx with:
sudo systemctl status nginx -
Access Nginx: Open a web browser and enter your server's IP address. You should see the default Nginx welcome page.
That's it! You have successfully installed Nginx on your system.
