How to install Nginx on a Linux server?

To install Nginx on a Linux server, you can follow these steps:

  1. Update the system:

    sudo apt update

    or

    sudo yum update
  2. Install Nginx:

    For Ubuntu/Debian:

    sudo apt install nginx

    For CentOS/RHEL:

    sudo yum install nginx
  3. Start Nginx:

    sudo systemctl start nginx
  4. Enable Nginx to start on boot:

    sudo systemctl enable nginx
  5. Verify the installation:

    Open a web browser and enter your server's IP address (e.g., http://your_server_ip) or domain name. If you see the default Nginx welcome page, then Nginx is installed and working correctly.

Note: The above steps are general and may vary slightly depending on the Linux distribution you are using.