Apache Web Server is a reference as a web server. However, for a few years now, Nginx has managed to steal a good share of the market from it. All this because Nginx is too fast and flexible in its configurations. So you should learn how to install Nginx on CentOS 8.
The most accurate definition of what Nginx is is the one we find on the project’s website:
Nginx is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server, originally written by Igor Sysoev.
Ngnix is known worldwide for its processing speed when the server is visited. This makes it ideal for web sites or web applications that will be heavily visited. That’s why most web sites are served with Nginx.
It is compatible with Linux, FreeBSD, Windows, and other operating systems compatible with many servers worldwide.
The main difference between Nginx and Apache is in its architecture. Because Nginx can handle multiple requests in a single thread while Apache will create a thread for each request. This has a direct impact on performance.
Some common features seen in Nginx include
- Reverse proxy with cache
- Load balancing
- FastCGI support with caching
- Handling of static files, index files, and auto-indexing
- TLS / SSL with SNI
So, you have to know about Nginx.
One of the advantages is that it can be installed very quickly and easily on CentOS 8 because it is available from official repositories.
Therefore, we have to open a terminal or start an SSH session to the server and start working.
First, update the distribution as the root user, run:
You can then install Nginx by running the following command:
dnf install nginx
You will then start the installation process which should not take long.
Once Nginx has been installed, the first thing you have to do is start the service so that it can work.
You can do this by running it:
systemctl start nginx
Nginx is a system service and you may make changes to its configuration, for these changes to be applied it is necessary to restart the service. This can be done in the following way:
systemctl restart nginx
And to check the status of the service, you can run:
systemctl status nginx
As well as, you can stop the service,
systemctl stop nginx
This way you can control the Ngnix service as you see fit.
By default, CentOS 8 comes with a firewall loaded and configured. This increases the security of our server. Therefore, the appropriate rules must be established so that it can support connections.
sudo firewall-cmd – permanent – add-service=http sudo firewall-cmd – permanent – add-service=https
And to apply the changes, you can restart the Firewall.
sudo firewall-cmd – reload
Now we can use Nginx.
Now from a client computer, you have to open a web browser and visit the following address:
And if you see an image like the one below, it means that everything is working correctly:
So the installation of Nginx has gone well and you can continue to configure it and make the most of it.
We have several very good web servers but perhaps the most used is Nginx. With a powerful architecture that can support many simultaneous visits, Nginx has become the world reference for how to run a web server. And now thanks to this post, you know how to install it in CentOS 8
Now we want to read you, have you used Nginx? do you prefer it over Apache? leave us a comment and share the post.