In this tutorial, we will show you how to install Nginx on Fedora 38. Are you looking for a powerful and efficient web server to serve your website or application on Fedora 37? Look no further than Nginx! Nginx (pronounced “engine x”) is a high-performance web server that is known for its speed and reliability. It’s designed to handle high-traffic websites and applications and is used by some of the world’s biggest companies, including Netflix, Airbnb, and Dropbox.
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 the step-by-step installation of the Nginx web server on a Fedora 38.
Prerequisites
- A server running one of the following operating systems: Fedora 38.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Nginx.
- 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 38
Step 1. Before we can install Nginx on Fedora 38, it’s important to ensure that our system is up-to-date with the latest packages. This will ensure that we have access to the latest features and bug fixes and that we can install Nginx without any issues:
sudo dnf upgrade --refresh
Step 2. Installing Nginx on Fedora 38.
Once your system is up to date, it’s time to install Nginx. To do this, run the following command:
sudo dnf install nginx
This command will download and install the latest version of Nginx, along with any necessary dependencies. After the installation is complete, we can start the Nginx service using the following command:
sudo systemctl start nginx sudo systemctl enable nginx
Step 3. Configuring Nginx.
Now that we have Nginx installed and running on our Fedora 37 system, we need to configure it to serve our website or application. To do this, we’ll need to create a new server block configuration file:
nano /etc/nginx/conf.d/your-domian.com.conf
Add the following server block configuration to your new configuration file:
server { listen 80; server_name your-domain.com; root /var/www/your-domain.com; index index.html; }
This configuration tells Nginx to listen on port 80 for incoming HTTP requests and serve content from the “/var/www/your-domain.com
” directory.
Save and exit the file, then test the new configuration file and ensure that it doesn’t contain any syntax errors, run the following command:
nginx -t
Step 4. Configure Firewall.
By default, Nginx listens on ports 80 and 443. If any firewall is installed and configured on your server, then you will need to allow both ports via firewalld. You can allow them with the following command:
sudo firewall-cmd --permanent --zone=public --add-service=http sudo firewall-cmd --permanent --zone=public --add-service=https sudo firewall-cmd --reload
You can verify by listing the current firewall settings:
sudo firewall-cmd --permanent --list-all
Step 5. Accessing Nginx Default Page.
Now, open your web browser and access the Nginx default page using the URL http://your-IP-address
. You should see the Nginx default page on Fedora:
Congratulations! You have successfully installed Nginx. Thanks for using this tutorial for installing the Nginx web server on your Fedora 38 system. For additional help or useful information, we recommend you check the official Nginx website.