{"id":14139,"date":"2024-06-13T14:52:55","date_gmt":"2024-06-13T11:52:55","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=14139"},"modified":"2024-06-13T14:55:28","modified_gmt":"2024-06-13T11:55:28","slug":"how-to-install-nginx-webserver-on-almalinux-8-10-systems","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-almalinux-8-10-systems\/","title":{"rendered":"How to Install Nginx Webserver on AlmaLinux 8.10 Systems"},"content":{"rendered":"\n
Nginx is a powerful and flexible web server that is widely used for serving web content, reverse proxying, caching, load balancing, and more. This guide will walk you through the steps to install and configure Nginx on an AlmaLinux 8.10 system.<\/p>\n\n\n\n
Before you start, ensure you have:<\/p>\n\n\n\n
First, update your system to ensure all existing packages are up to date.<\/p>\n\n\n\n
$ sudo dnf update -y<\/code><\/pre>\n\n\n\nStep 2: Install EPEL Repository<\/h3>\n\n\n\n
The EPEL (Extra Packages for Enterprise Linux) repository provides additional packages that are not included in the default repositories. Install EPEL to get access to more software packages.<\/p>\n\n\n\n
$ sudo dnf install epel-release -y<\/code><\/pre>\n\n\n\nStep 3: Install Nginx<\/h3>\n\n\n\n
With the EPEL repository enabled, you can install Nginx using the dnf<\/code> package manager.<\/p>\n\n\n\n$ sudo dnf install nginx -y<\/code><\/pre>\n\n\n\nStep 4: Start and Enable Nginx<\/h3>\n\n\n\n
After installing Nginx, start the Nginx service and enable it to start on boot.<\/p>\n\n\n\n
$ sudo systemctl start nginx\n$ sudo systemctl enable nginx<\/code><\/pre>\n\n\n\nStep 5: Configure Firewall<\/h3>\n\n\n\n
If your system has a firewall enabled, allow HTTP and HTTPS traffic to access the web server.<\/p>\n\n\n\n
$ sudo firewall-cmd --permanent --add-service=http\n$ sudo firewall-cmd --permanent --add-service=https\n$ sudo firewall-cmd --reload<\/code><\/pre>\n\n\n\nStep 6: Verify Nginx Installation<\/h3>\n\n\n\n
To verify that Nginx is installed and running correctly, open a web browser and navigate to your server’s IP address. You should see the default Nginx welcome page.<\/p>\n\n\n\n
Alternatively, you can use the curl<\/code> command to check the Nginx welcome page:<\/p>\n\n\n\n$ curl http:\/\/localhost<\/code><\/pre>\n\n\n\nYou should see the HTML content of the Nginx welcome page.<\/p>\n\n\n\n
Step 7: Basic Nginx Configuration<\/h3>\n\n\n\n
Nginx configuration files are located in the \/etc\/nginx<\/code> directory. The main configuration file is \/etc\/nginx\/nginx.conf<\/code>, and the default server block configuration file is \/etc\/nginx\/conf.d\/default.conf<\/code>.<\/p>\n\n\n\nEdit the Default Server Block<\/h4>\n\n\n\n
To customize your server, edit the default server block configuration.<\/p>\n\n\n\n
$ sudo nano \/etc\/nginx\/conf.d\/default.conf<\/code><\/pre>\n\n\n\nYou can modify the server block to match your requirements. Here is a basic example:<\/p>\n\n\n\n
server {\n listen 80;\n server_name your_domain_or_IP;\n\n location \/ {\n root \/usr\/share\/nginx\/html;\n index index.html index.htm;\n }\n\n error_page 404 \/404.html;\n location = \/40x.html {\n }\n\n error_page 500 502 503 504 \/50x.html;\n location = \/50x.html {\n }\n}<\/code><\/pre>\n\n\n\nReplace your_domain_or_IP<\/code> with your domain name or IP address. Save the file and exit the text editor.<\/p>\n\n\n\nTest Nginx Configuration<\/h4>\n\n\n\n
Before restarting Nginx, it’s a good practice to test the configuration for any syntax errors.<\/p>\n\n\n\n
$ sudo nginx -t<\/code><\/pre>\n\n\n\nIf the test is successful, restart Nginx to apply the changes.<\/p>\n\n\n\n
$ sudo systemctl restart nginx<\/code><\/pre>\n\n\n\nStep 8: Setting Up SSL with Let’s Encrypt (Optional)<\/h3>\n\n\n\n
For securing your website with HTTPS, you can use Let’s Encrypt to obtain a free SSL certificate. First, install Certbot, the Let’s Encrypt client.<\/p>\n\n\n\n
$ sudo dnf install certbot python3-certbot-nginx -y<\/code><\/pre>\n\n\n\nUse Certbot to obtain and install the SSL certificate.<\/p>\n\n\n\n
$ sudo certbot --nginx<\/code><\/pre>\n\n\n\nFollow the prompts to configure your SSL certificate. Certbot will automatically modify your Nginx configuration to use the SSL certificate.<\/p>\n\n\n\n
Step 9: Verify SSL Configuration<\/h3>\n\n\n\n
After installing the SSL certificate, you can test your site using HTTPS.<\/p>\n\n\n\n
$ curl -I https:\/\/your_domain_or_IP<\/code><\/pre>\n\n\n\nYou should see HTTP headers indicating a successful HTTPS connection.<\/p>\n\n\n\n
Conclusion<\/h3>\n\n\n\n
You have successfully installed and configured Nginx on your AlmaLinux 8.10 system. Nginx is now ready to serve your web content with high performance and reliability. For more advanced configurations and optimizations, refer to the official Nginx documentation.<\/p>\n\n\n\n
Happy hosting!<\/p>\n\n\n\n
References<\/h3>\n\n\n\n\n- Nginx Official Website<\/a><\/li>\n\n\n\n
- AlmaLinux Official Website<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"
Nginx is a powerful and flexible web server that is widely used for serving web content, reverse proxying, caching, load balancing, and more. This guide will walk you through the…<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,23,24,9,25,27,16],"tags":[1282,193,354,424,433,449,472,531,572,573,591],"yoast_head":"\n
How to Install Nginx Webserver on AlmaLinux 8.10<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n