Nginx and Apache are popular web services used to deliver websites to a user's browser. Below, we show you how to install one of these services on your system.
Before starting the actual installation of a web server, you need to ensure that your system is up to date. To do this, connect to your server via SSH. If you don’t know what SSH is or how to use it, check out our guide: First Access (SSH).
Once connected, update your system with the following command depending on your operating system:
// Debian
sudo apt-get update
// Ubuntu
sudo apt update
// CentOS
sudo yum update
// OpenSUSE
sudo zypper update
// Fedora
sudo dnf upgrade --refresh
After preparation is complete, you can start installing the web server. Depending on your operating system and web server, run the following commands:
// Debian
sudo apt install apache2
// Ubuntu
sudo apt install apache2
// CentOS
sudo yum install httpd
// OpenSUSE
sudo zypper install httpd
// Fedora
sudo dnf install httpd
After installing the web server, you can upload your website files. Connect via FTP/SFTP to your server, navigate to the following directory, and upload your files.
/var/www/html/
// Debian
sudo apt install nginx
// Ubuntu
sudo apt install nginx
// CentOS
sudo yum install nginx
// OpenSUSE
sudo zypper install nginx
// Fedora
sudo dnf install nginx
After installing the web server, you can upload your website files. Connect via FTP/SFTP to your server, navigate to the following directory, and upload your files.
/usr/share/nginx/html
Once the installation is complete, you can verify if it was successful by running apache2 -v (Apache) or nginx -v (Nginx). The output should look similar to this:
apache2 -v
Server version: Apache/2.4.41 (Ubuntu)
Server built: XXXX-XX-XXTXX:XX:XX
nginx -V
nginx version: nginx/1.2.3
...
If you see output like this, the web server was installed successfully.