Nginx® is a web-server service with as much market share as Apache®
because of its excellent performance and flexible feature set. This guide
describes how to install Nginx and discusses the next steps for setting up Nginx
to serve your site or application.
You need a Linux® server running Fedora®.
Nginx is available in the default repositories for most popular Linux®
distributions, including Fedora. To install Nginx, run the following
sudo dnf install nginx
Enter y at the prompt to confirm that you want to install the package.
After the installation completes, run the following commands to enable and start
the service. These commands start Nginx and configure it to start up when the
sudo systemctl enable nginx sudo systemctl start nginx
By default, Nginx listens on the default ports for HTTP and HTTPS traffic (Ports
443). However, this does not mean that it receives traffic
because the firewall on the system also needs to allow traffic on these ports.
Use the following commands to add the ports necessary for your site by adding
the HTTP and HTTPS services:
sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --permanent --add-service=https
firewalld to apply the new settings:
sudo firewall-cmd --reload
After you install the package and open the firewall port or ports, Nginx should
display its default web page. You can see this by typing your IP address in your
web browser. You should see a splash page with the Nginx logo and a "Welcome to
Nginx" message. If you do not see this, double-check that the IP address is
correct, Nginx is running, and the firewall settings are correct.
You can now use Nginx to start serving your application or website. Use the
default configuration to serve a site by putting its content in the
/var/www/html directory in your filesystem. If you want to serve more than
one site, we recommend that setting Nginx server blocks to accommodate this
Updated 26 days ago