DevTools Logo

Apache Config Generator

Apache Config Generator

Build an Apache 2.4 VirtualHost — ServerName, DocumentRoot, Directory, aliases, and optional SSL.

VirtualHost

site.conf

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/example
    <Directory /var/www/example>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
client-side
Apache 2.4

Examples

HTTP site

Input
ServerName example.com, DocumentRoot /var/www/example, Directory with AllowOverride All
Output
<VirtualHost *:80>
    ServerName example.com
    DocumentRoot /var/www/example
    <Directory /var/www/example>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

A basic HTTP vhost that allows .htaccess overrides.

About this tool

The Apache Config Generator writes an Apache 2.4 VirtualHost block. Set the ServerName and optional alias, the DocumentRoot, and the port; add a Directory block, aliases, and SSL when needed. The output uses modern Require all granted access control — nothing is uploaded.

How to use

  1. Set the host

    Enter the ServerName and an alias, plus the DocumentRoot.

  2. Add Directory or SSL

    Include a Directory block for options, and toggle SSL for port 443 with cert paths.

  3. Enable the site

    Save under sites-available and run a2ensite, then reload Apache.

Use cases

New virtual host

Stand up a config for a new domain.

HTTPS migration

Add an SSL vhost on 443 alongside the HTTP one.

Common mistakes

Mistake:Using 2.2 Allow/Deny syntax.

Fix:Apache 2.4 uses Require all granted — the builder emits the modern form.

Frequently asked questions

References & standards