In this tutorial, we will show you how to install Nginx on Fedora 35. For those of you who didn’t know, Nginx (Pronounce as Engine X) is a popular open-source web server that can be used as a reverse proxy and load balancer for your servers. Its scalability and efficiency make Nginx both suitable for small and high-traffic servers. It can also function as a proxy server for email IMAP, POP3, and SMTP.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you through the step-by-step installation of the Nginx on a Fedora 35.
Prerequisites
- A server running one of the following operating systems: Fedora 34 or Fedora 35.
- It’s recommended that you use a fresh OS install to prevent any potential issues
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Nginx on Fedora 35
Step 1. Before proceeding, update your Fedora operating system to make sure all existing packages are up to date. Use this command to update the server packages:
sudo dnf upgrade sudo dnf update
Step 2. Installing Nginx on Fedora 35.
By default, Nginx is available on Fedora 35 base repository. Then we can install Nginx with the following command:
sudo dnf install nginx
Verify the installation using this command:
nginx -v
Output:
nginx version: nginx/1.20.2
Now After installation is complete we need to start the Nginx server to start operating. We do that with the following command below:
sudo systemctl start nginx sudo systemctl enable nginx sudo systemctl status nginx
Step 3. Nginx Configuration File’s Structure.
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
Step 4. Configure Firewall.
We need to enable the firewall in order to filter traffic into our server. Now we add HTTP and HTTPS ports in the firewall using the following command:
sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --permanent --add-service=https sudo firewall-cmd --reload
Step 5. Accessing Nginx Web Test Page.
Once successfully installed, open your web browser and access the Nginx using the URL http://your-IP-address
. You will get the following screen:
Congratulations! You have successfully installed Nginx. Thanks for using this tutorial for installing the Nginx web server on your Fedora 35 system. For additional help or useful information, we recommend you check the official Nginx website.