Install Nginx on CentOS 9 Stream - Step by step guide ?
Centos
Nginx (Engine X) is the most popular, powerful web server software that can be used on your server. It is also known for its high performance and low memory usage. In addition to its HTTP server capabilities, NGINX can also function as a proxy server for e-mail (IMAP, POP3, and SMTP) and a reverse proxy and load balancer for HTTP, TCP, and UDP servers.
Here at Fixwebnode , as part of our Server Management Services , we regularly help our Customers to perform related Nginx queries.
In this context, we shall look into how to install Nginx on CentOS 9 Stream.
Table of contents [Show]
Main features of Nginx include:
- Reverse proxy with caching.
- IPv6.
- Load balancing.
- FastCGI support with caching.
- WebSockets.
- Handling of static files, index files, and auto-indexing.
- TLS/SSL with SNI.
Steps to Install and configure Nginx on CentOS 9 Stream
1. Perform System Update
To begin, ensure that your system is up-to-date with the below command:
$ sudo dnf update
2. Install Nginx on the system
By default, Nginx is available on the CentOS 9 Stream base repository. Now we run the following command to install Nginx to your system:
$ sudo dnf install nginx
Once the installation is complete, now enable Nginx (to start automatically upon system boot), start the webserver, and verify the status using the commands below:
$ sudo systemctl start nginx
$ sudo systemctl enable nginx
$ sudo systemctl status nginx
To verify the Nginx version, use the following command to confirm:
$ nginx -v
3. Configure Firewall
If your server is protected by a firewall you need to open both HTTP (80) and HTTPS (443) ports:
$ sudo firewall-cmd --permanent --zone=public --add-service=http
$ sudo firewall-cmd --permanent --zone=public --add-service=https
$ sudo firewall-cmd --reload
4. Confirm Nginx Installation
Once successfully installed, open http://your-IP-address in your browser of choice, and you will see the default Nginx welcome page .
5. Nginx Configuration File's Structure
You don't need to configure Nginx upon installation. However, you should know the location of the configuration files and the Nginx root directory in case you need to modify the configuration:
- Nginx configuration directory: /etc/nginx
- Nginx root directory: /usr/share/nginx/html
- Master/Global configuration file: /etc/nginx/nginx.conf
[Need help in fixing Nginx configuration issues ? We can help you . ]
This article covers how to install the Nginx web server on CentOS 9 Stream. In fact, Nginx acts as a reverse proxy server and load balancer.