Article 10.3 Apache2 — Install & Virtual Host — VPSGrid Knowledge Base
English
EnglishBeta EspañolPortuguês (Brasil)Coming soonFrançaisComing soonDeutschComing soon
Client Area

Article 10.3 Apache2 — Install & Virtual Host

0 found helpful

Article 10.3 Apache2 — Install & Virtual Host

Short answer

apt install apache2, enable ssl/rewrite/headers modules, create vhost, a2ensite, certbot --apache for TLS.

Overview

Apache2 suits LAMP stacks and .htaccess workflows. You manage vhosts and TLS inside the guest OS.

Install

apt install apache2 -y
a2enmod ssl rewrite headers
systemctl enable apache2 --now

Example vhost

<VirtualHost *:80>
    ServerName example.com
    Redirect permanent / https://example.com/
</VirtualHost>

<VirtualHost *:443>
    ServerName example.com
    DocumentRoot /var/www/example.com/public
    SSLEngine on
    SSLCertificateFile    /etc/letsencrypt/live/example.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
    Header always set Strict-Transport-Security "max-age=63072000"
    <Directory /var/www/example.com/public>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
a2ensite example.com.conf
apache2ctl configtest && systemctl reload apache2
apt install python3-certbot-apache -y
certbot --apache -d example.com

Distribution guides: Apache on Ubuntu/Debian, Apache on AlmaLinux/Rocky.

Frequently Asked Questions

Apache or Nginx?

Either works on VPSGrid. Nginx is common for static/PHP-FPM; Apache if you need .htaccess-heavy shared hosting patterns.

403 Forbidden?

Check DocumentRoot permissions and Require all granted in Directory block.

Related Articles

Need More Help?

Search this knowledgebase for related guides. If the issue persists, open a ticket at billing.vpsgrid.net with your service ID, primary IP, and steps already tried. See What Information to Include in a Support Request and Security Responsibilities on Unmanaged VPS for scope and required details.

Was this answer helpful?

Related Articles