Prerequisites
Before installing Apache, make sure you have:
- SSH access to your VPS
- Root or sudo privileges
Install Apache on Ubuntu/Debian
Connect to your VPS:
ssh hxroot@YOUR_SERVER_IP -p 22
apt update
apt install apache2 -y
Start and Enable Apache
systemctl start apache2
systemctl enable apache2
Configure Firewall
ufw allow 80/tcp
ufw allow 443/tcp
Verify Apache is Running
systemctl status apache2
Visit your server IP in browser - you should see the Apache default page.
Apache Configuration Files
Main config: /etc/apache2/apache2.conf
Sites available: /etc/apache2/sites-available/
Sites enabled: /etc/apache2/sites-enabled/
✅ Apache web server has been installed.