Installing the Nginx web server
Learn how to install the popular Nginx web server on your unmanaged hosting account!
This article describes how to install Nginx, a popular web server noted for its high performance. Nginx was originally designed as an alternative to the Apache web server, with an emphasis on speed.
Important
You must have root access to the server to follow the procedures described below.
Installing Nginx
To install Nginx, follow the appropriate procedure below for the Linux distribution installed on your server. If your server does not use any of the following Linux distributions, see the documentation for your distribution for information about how to install Nginx.
Debian and Ubuntu
To install Nginx on Debian and Ubuntu, follow these steps:
-
Log in to the server using SSH.
-
As the root user, type the following commands:
apt update apt install nginx
-
Use your web browser to visit the IP address (or domain name, if you have one configured) of your server. You should see the default Welcome to nginx! page.
AlmaLinux and Fedora
To install Nginx on AlmaLinux and Fedora, follow these steps:
-
Log in to the server using SSH.
-
As the root user, type the following commands:
yum -y update yum -y install epel-release yum -y install nginx systemctl enable nginx
-
Use your web browser to visit the IP address (or domain name, if you have one configured) of your server. You should see the default Welcome page.
Publishing web content
The default document root directory location varies depending on the Linux distribution you are using:
-
For Debian and Ubuntu, the document root directory is /var/www/html.
-
For AlmaLinux and Fedora, the document root directory is /usr/share/nginx/html.
To publish content, place your files in the document root directory so site visitors can access them.
More Information
To view the official online documentation for Nginx, please visit http://nginx.org/en/docs.
Updated 3 days ago