Apache VirtualHost Generator
Fill in a domain, pick static files or a reverse proxy, and get a complete <VirtualHost> block — SSL, logging, directory permissions and upload limits included. Nothing here is uploaded or run; copy it into /etc/apache2/sites-available/ yourself.
Basics
Domain & file
ServerName is what Apache matches the request's Host header against; everything else follows from it.
space-separated
Content
What this vhost serves
Files under this path are served directly. Permissions and <Directory> settings are below.
SSL
HTTPS virtual host
older cert bundles only
Logging & access
Logs and directory permissions
Directory Optionsstatic site mode only — a reverse proxy has no local directory to serve
Uploads
Request body size
Apache's own equivalent of nginx's client_max_body_size. Only needed if this vhost accepts uploads.
Validation
Common mistakes, checked live
Ports do not collide
Config file name ends in .conf
Every VirtualHost block is closed
Output
apache2 vhost config
apache2 vhost config
<VirtualHost *:80>
ServerName app.wespner.eu
ServerAlias www.app.wespner.eu
# Redirect every request to HTTPS, preserving path and query string
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [END,NE,R=permanent]
ErrorLog "/var/log/apache2/app.wespner.eu-error.log"
CustomLog "/var/log/apache2/app.wespner.eu-access.log" combined
</VirtualHost>
<VirtualHost *:443>
ServerName app.wespner.eu
ServerAlias www.app.wespner.eu
SSLEngine on
SSLCertificateFile "/etc/letsencrypt/live/app.wespner.eu/fullchain.pem"
SSLCertificateKeyFile "/etc/letsencrypt/live/app.wespner.eu/privkey.pem"
DocumentRoot "/var/www/app.wespner.eu/public"
<Directory "/var/www/app.wespner.eu/public">
Options -Indexes FollowSymLinks -MultiViews
AllowOverride None
Require all granted
</Directory>
ErrorLog "/var/log/apache2/app.wespner.eu-error.log"
CustomLog "/var/log/apache2/app.wespner.eu-access.log" combined
</VirtualHost>deploy it
# 1. Save the config above as: sudo nano /etc/apache2/sites-available/app.wespner.eu.conf # 2. Enable the modules this vhost needs sudo a2enmod ssl rewrite # 3. Enable the site sudo a2ensite app.wespner.eu.conf # 4. Test the config, then reload Apache sudo apachectl configtest && sudo systemctl reload apache2
Running your own game server?
Wespner game servers with DDoS protection, NVMe drives and activation within minutes.