How To Install Nginx on Rocky Linux 9

Nginx is one of the most popular web servers in the world and is responsible for hosting some of the largest and highest-traffic sites on the internet. It is a lightweight choice that can be used as either a web server or reverse proxy.

In this guide, you’ll review how to install Nginx on your Rocky Linux 9 server, adjust the firewall, manage the Nginx process, and set up server blocks for hosting more than one domain from a single server.

Before you begin this guide, you should have a regular, non-root user with sudo privileges configured on your server.

Step 1 – Installing Nginx

Because Nginx is available in Rocky’s default repositories, you can install it with a single command, using the dnf package manager.

Install the nginx package with dnf install:

sudo dnf install nginx

After the installation is finished, run the following commands to enable and start the web server:

sudo systemctl enable nginx
sudo systemctl start nginx

This will make Nginx restart automatically whenever your server reboots. Your new web server should now be up and running, but before testing it, you’ll probably need to make a change to your firewall configuration.

Step 2 – Checking your Web Server

At this point, your web server should be up and running. You can use the systemctl status command to make sure the service is running:

systemctl status nginx

As confirmed by this output, the service has started successfully. However, the best way to test this is to actually request a page from Nginx. When you have your server’s IP address, enter it into your browser’s address bar.

How to Solve 13: Permission denied browse for file in nginx Rocky Linux 9

Here is the solution for resolve failed (13: Permission denied) when you test open file from your server in browser.

First at all, you must login as root user to follow this method.

setsebool -P httpd_enable_homedirs 1
setenforce 0
systemctl restart nginx
systemctl daemon-reload

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.