How to Install Nginx on Amazon Linux 2023?
Nginx is a high-performance web server and reverse proxy server. It is known for its stability, rich feature set, simple configuration, and low resource consumption. In this guide, we'll walk you through the steps to install Nginx on Amazon Linux 2023.
Prerequisites
Before you start, make sure you have:
- An instance of Amazon Linux 2023 running.
- Sudo or root access on your instance.
Step 1: Update Your System
First, ensure your system is up to date by running the following commands:
sudo dnf update -y
sudo dnf upgrade -y
Step 2: Install Nginx
Next, we'll install Nginx using the Amazon Linux 2023 package repository. Run the following command to install Nginx:
sudo dnf install nginx -y
Step 3: Start and Enable Nginx
After installing Nginx, you need to start the Nginx service and enable it to start on boot:
sudo systemctl start nginx
sudo systemctl enable nginx
Step 4: Verify the Nginx Installation
To verify that Nginx is installed correctly, open your web browser and enter the public IP address of your Amazon Linux instance. You should see the default Nginx welcome page.
Step 5: Configure Your Firewall
If you have a firewall running, you'll need to allow HTTP and HTTPS traffic. Run the following commands to allow this traffic:
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
Step 6: Test Nginx Installation
Finally, let's test if Nginx is working correctly by opening your web browser and navigating to your server's IP address. You should see the default Nginx welcome page.
Conclusion
You have successfully installed Nginx on Amazon Linux 2023! You can now start configuring Nginx to serve your web applications. For more information on using Nginx, check out the official Nginx documentation.
Comments
Post a Comment