Skip to content

Setting Up Nginx and Apache on a Linux Server – Configuring Powerful Web Server Environments

Discover how to set up and configure Nginx or Apache web servers to efficiently host your website → Learn more now

12 November 20261 min read29 Views0 helpful

Introduction

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.

Preparation

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:

Code
// Debian
sudo apt-get update

// Ubuntu
sudo apt update

// CentOS
sudo yum update

// OpenSUSE
sudo zypper update

// Fedora
sudo dnf upgrade --refresh

Installation

After preparation is complete, you can start installing the web server. Depending on your operating system and web server, run the following commands:

Apache

Code
// 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.

Code
/var/www/html/

Nginx

Code
// 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.

Code
/usr/share/nginx/html

Version Check

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:

Apache

Code
apache2 -v
Server version: Apache/2.4.41 (Ubuntu)
Server built:   XXXX-XX-XXTXX:XX:XX

Nginx

Code
nginx -V
nginx version: nginx/1.2.3
...

If you see output like this, the web server was installed successfully.

FAQ

Frequently asked questions

Connect via SSH, update your system, and install Apache depending on your distribution, for example with sudo apt install apache2 on Debian/Ubuntu or sudo yum install httpd on CentOS.
After updating your system, install Nginx depending on your distribution, for example with sudo apt install nginx on Debian/Ubuntu or sudo yum install nginx on CentOS.
Connect via FTP/SFTP to your server and upload your files to the /var/www/html/ directory.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 people found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.