Install Nginx Web Server on Fedora 30

|
Published:
|
|

In this guide, we are going to discuss how to install Nginx web server on Fedora 30. Nginx, commonly pronounced as Engine ex, is an open-source, high-performance HTTP server. It can also function as a load balancer, reverse proxy, as well as an IMAP/POP3 proxy server. 

Install Nginx Web Server on Fedora 30

Nginx is available on the default Fedora repositories and hence can be installed directly using the DNF package manager.

dnf install nginx
Last metadata expiration check: 0:00:30 ago on Mon 06 May 2019 06:36:34 PM EAT.
Dependencies resolved.
=======================================================================================================================================================
 Package                                  Architecture                   Version                                 Repository                       Size
=======================================================================================================================================================
Installing:
 nginx                                    x86_64                         1:1.16.0-1.fc30                         updates                         551 k
Upgrading:
 nginx-filesystem                         noarch                         1:1.16.0-1.fc30                         updates                          10 k
Installing dependencies:
 gperftools-libs                          x86_64                         2.7-5.fc30                              fedora                          287 k
 libunwind                                x86_64                         1.3.1-2.fc30                            fedora                           63 k
 nginx-mimetypes                          noarch                         2.1.48-5.fc30                           fedora                           20 k

Transaction Summary
=======================================================================================================================================================
Install  4 Packages
Upgrade  1 Package

Total download size: 931 k
Is this ok [y/N]: y

Running Nginx

Well, once the installation of Nginx is done, it is time to start it. However, if you have Apache installed and running on the same server, you need to stop and disable it from running so that you can use Nginx instead.

Disable Apache (if installed)

systemctl stop httpd
systemctl disable httpd

Start Nginx

Nginx can be started by executing the command;

systemctl start nginx

Enable Nginx to run on system boot.

If you need your Nginx HTTP server to run by default every time your server reboots, then you need to run this command;

systemctl enable nginx

Check the status of Nginx

systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/nginx.service.d
           └─php-fpm.conf
   Active: active (running) since Mon 2019-05-06 18:45:25 EAT; 2min 13s ago
 Main PID: 25811 (nginx)
    Tasks: 2 (limit: 1144)
   Memory: 2.5M
   CGroup: /system.slice/nginx.service
           ├─25811 nginx: master process /usr/sbin/nginx
           └─25812 nginx: worker process

May 06 18:45:24 fedora30.example.com systemd[1]: Starting The nginx HTTP and reverse proxy server...
May 06 18:45:25 fedora30.example.com nginx[25809]: nginx: [warn] could not build optimal types_hash, you should increase either types_hash_max_size: 2>
May 06 18:45:25 fedora30.example.com nginx[25809]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
May 06 18:45:25 fedora30.example.com nginx[25809]: nginx: configuration file /etc/nginx/nginx.conf test is successful
May 06 18:45:25 fedora30.example.com nginx[25810]: nginx: [warn] could not build optimal types_hash, you should increase either types_hash_max_size: 2>
May 06 18:45:25 fedora30.example.com systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
May 06 18:45:25 fedora30.example.com systemd[1]: Started The nginx HTTP and reverse proxy server.

Allow Nginx on Firewalld

If you are running firewalld (running by default on Fedora 30) you need to allow Nginx through it to make accessible from outside the localhost.

firewall-cmd --add-service={http,https} --permanent
firewall-cmd --reload

Testing Nginx

Next, navigate to the web browser and test if you can access Nginx web server via the http://<hostname-or-server-IP-address>. If all is well, this will land you on Fedora Nginx test page.

install Nginx web server on Fedora 30

Well, you are good to go. You can now perform any web server configurations to suit your needs. Cheers.

You can also check our previous guide on installing Apache web server on Fedora 30.

Install Apache on Fedora 30

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
koromicha
I am the Co-founder of Kifarunix.com, Linux and the whole FOSS enthusiast, Linux System Admin and a Blue Teamer who loves to share technological tips and hacks with others as a way of sharing knowledge as: "In vain have you acquired knowledge if you have not imparted it to others".

Leave a Comment