Installing the Nginx Web Server
Learn how to set up the high-performance Nginx web server on an unmanaged hosting environment.
This guide explains how to install Nginx, a fast and efficient web server originally created as a high-speed alternative to Apache.
| Important Root access is required to perform the steps in this guide. |
Installing Nginx
Follow the steps that match the Linux distribution running on your server. If your system uses a different distribution, refer to its documentation for installation instructions.
Debian and Ubuntu
To install Nginx:
-
Log in to your server through SSH.
-
As the root user, run:
apt update
apt install nginx
-
Visit your server’s IP address or domain name in a web browser. You should see the default “Welcome to nginx!” page.
AlmaLinux and Fedora
To install Nginx:
-
Log in to the server using SSH.
-
As root, run:
yum -y update
yum -y install epel-release
yum -y install nginx
systemctl enable nginx
-
Visit your server’s IP address or domain name in a browser to confirm the default Nginx Welcome page is displayed.
Publishing Web Content
The document root (where you place your website files) depends on your Linux distribution:
-
Debian / Ubuntu:
/var/www/html -
AlmaLinux / Fedora:
/usr/share/nginx/html
Upload your files to the appropriate directory so visitors can access your website.
More Information
Official Nginx documentation is available at:
nginx.org/en/docs