PingRack
Linux Server

How to Install and Configure Apache or Nginx on PingRack VPS Hosting

This guide walks you through installing, configuring, and securing Apache or Nginx web servers on your PingRack Linux or Windows VPS, including firewall setup, virtual host configuration, and service management.

0 viewsUpdated 30 October 2026

Overview

PingRack VPS hosting gives you full root access to deploy the web server of your choice. This article covers installing Apache and Nginx on both Linux (Ubuntu/Debian, AlmaLinux/Rocky) and Windows VPS environments, configuring virtual hosts, and opening the required firewall ports.

Note: All commands below assume you are logged in as root or a user with sudo privileges. On PingRack VPS, the default user is typically root or ubuntu/admin depending on the OS template selected.

Prerequisites

  • A running PingRack VPS (Linux or Windows)
  • Root or sudo access
  • A domain name pointed to your VPS IP (optional but recommended)
  • SSH access (Linux) or RDP access (Windows)

1. Open Firewall Ports (Linux VPS)

Before installing the web server, ensure HTTP (port 80) and HTTPS (port 443) are allowed through the firewall.

Using UFW (Ubuntu/Debian)

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw reload

Using firewalld (AlmaLinux/Rocky/CentOS)

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
PingRack Tip: If you're using PingRack's Cloud Firewall (available in the client area), you can also open these ports via the control panel under Networking → Firewall Rules.

2. Install Apache

Ubuntu / Debian

sudo apt update
sudo apt install apache2 -y
sudo systemctl start apache2
sudo systemctl enable apache2

AlmaLinux / Rocky / CentOS

sudo dnf install httpd -y
sudo systemctl enable --now httpd

Verify Installation

Visit http://your-vps-ip in a browser. You should see the default Apache test page.


3. Install Nginx

Ubuntu / Debian

sudo apt update
sudo apt install nginx -y
sudo systemctl start nginx
sudo systemctl enable nginx

AlmaLinux / Rocky / CentOS

sudo dnf install nginx -y
sudo systemctl enable --now nginx

Verify Installation

Visit http://your-vps-ip in a browser. You should see the default Nginx welcome page.


4. Configure Virtual Hosts (Server Blocks)

Virtual hosts allow you to host multiple websites on a single VPS.

For Apache (Ubuntu/Debian)

  • Create the document root:
sudo mkdir -p /var/www/your_domain/html
   sudo chown -R $USER:$USER /var/www/your_domain/html
   sudo chmod -R 755 /var/www/your_domain
   echo "<h1>your_domain is live on PingRack VPS</h1>" | sudo tee /var/www/your_domain/html/index.html
  • Create a virtual host file:
sudo nano /etc/apache2/sites-available/your_domain.conf

Paste the following configuration:

<VirtualHost *:80>
       ServerName your_domain
       ServerAlias www.your_domain
       DocumentRoot /var/www/your_domain/html
       ErrorLog ${APACHE_LOG_DIR}/error.log
       CustomLog ${APACHE_LOG_DIR}/access.log combined
   </VirtualHost>
  • Enable the site and reload Apache:
sudo a2ensite your_domain.conf
   sudo systemctl reload apache2

For Nginx (Ubuntu/Debian)

  • Create the document root (same as above).
  • Create a server block file:
sudo nano /etc/nginx/sites-available/your_domain

Paste the following configuration:

server {
       listen 80;
       server_name your_domain www.your_domain;
       root /var/www/your_domain/html;
       index index.html;

location / { try_files $uri $uri/ =404; } }

  • Enable the site and reload Nginx:
sudo ln -s /etc/nginx/sites-available/your_domain /etc/nginx/sites-enabled/
   sudo nginx -t
   sudo systemctl reload nginx
Important: Replace your_domain with your actual domain name (e.g., example.com) throughout.

5. Windows VPS Installation

PingRack Windows VPS supports both web servers via native Windows binaries.

Apache on Windows

  • Recommended: Use XAMPP or WAMP for an all-in-one stack (Apache, MySQL, PHP).
  • Download the Windows installer from apachefriends.org or wampserver.aviatechno.net.
  • Run the installer via RDP and follow the setup wizard.
  • Apache will be installed as a Windows service and managed via the XAMPP/WAMP control panel.

Nginx on Windows

  • Download the Windows binary from nginx.org/en/download.html.
  • Extract to C:\nginx (or your preferred path).
  • Edit conf\nginx.conf to configure your server block.
  • Start Nginx via Command Prompt (run as Administrator):
cd C:\nginx
  start nginx
  • To manage as a service, use tools like NSSM (Non-Sucking Service Manager) or WinSW.

Windows Firewall

Open ports 80 and 443 in Windows Defender Firewall with Advanced Security → Inbound Rules → New Rule → Port → TCP → 80, 443 → Allow the connection.


6. Secure with HTTPS (Let's Encrypt)

For production sites, enable HTTPS using Certbot.

Apache (Ubuntu/Debian)

sudo apt install certbot python3-certbot-apache -y
sudo certbot --apache -d your_domain -d www.your_domain

Nginx (Ubuntu/Debian)

sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d your_domain -d www.your_domain

Certbot will automatically update your virtual host configuration and set up auto-renewal.


7. Common Service Management Commands

| Action | Apache (Ubuntu) | Nginx (Ubuntu) | Apache (RHEL) | Nginx (RHEL) | |--------|-----------------|----------------|---------------|--------------| | Start | systemctl start apache2 | systemctl start nginx | systemctl start httpd | systemctl start nginx | | Stop | systemctl stop apache2 | systemctl stop nginx | systemctl stop httpd | systemctl stop nginx | | Restart | systemctl restart apache2 | systemctl restart nginx | systemctl restart httpd | systemctl restart nginx | | Reload | systemctl reload apache2 | systemctl reload nginx | systemctl reload httpd | systemctl reload nginx | | Status | systemctl status apache2 | systemctl status nginx | systemctl status httpd | systemctl status nginx | | Enable on boot | systemctl enable apache2 | systemctl enable nginx | systemctl enable httpd | systemctl enable nginx |


8. PingRack-Specific Tips

  • Snapshots: Before making major changes, create a snapshot in the PingRack client area (VPS → Snapshots) for easy rollback.
  • Monitoring: Use PingRack's built-in Resource Monitoring (CPU, RAM, Disk, Network) to track web server performance.
  • Backups: Enable Automated Backups (daily/weekly) to protect your web content and configurations.
  • Support: If you encounter issues, open a ticket via Support → New Ticket with your VPS hostname and relevant logs (/var/log/apache2/error.log or /var/log/nginx/error.log).

Next Steps

  • [Configure PHP-FPM with Nginx on PingRack VPS]
  • [Set Up Reverse Proxy with Nginx]
  • [Hardening Apache/Nginx Security Headers]
  • [Enable HTTP/2 on Nginx]

Need help? Contact PingRack support 24/7 via live chat, ticket, or email at support@pingrack.com.