DevOps & Config Tools

Apache Virtual Host Generator

Work on several projects at once with addresses like shop.test and blog.test instead of localhost/shop. List each local domain with its project folder, choose XAMPP on Windows or macOS, WampServer or Apache on Linux, and get the virtual host configuration, the lines for your hosts file and the exact steps to enable them, with optional HTTPS using locally trusted certificates from mkcert.

  • Runs in your browser
  • No sign-up
  • Free to use
Start from an example

Use .test or .localhost domains; they are reserved for local use and never reach the internet.

Options

    How to use Apache Virtual Host Generator

    1. Choose your local server.
    2. List sites as domain -> project folder.
    3. Pick HTTPS, .htaccess and logging options.
    4. Follow the steps: config file, hosts file, restart.

    Apache Virtual Host Generator features

    Many sites

    One virtual host per project, each with its own domain.

    Hosts file

    IPv4 and IPv6 lines for every domain and its www alias.

    Your setup

    Paths for XAMPP (Windows, macOS), WampServer and Linux.

    HTTPS locally

    mkcert commands and SSL virtual hosts.

    localhost kept

    The default host still serves htdocs.

    Checks

    Warnings about .dev, .local and real domains.

    When to use Apache Virtual Host Generator

    • Running Laravel, WordPress and other projects side by side.
    • Testing sites under their own domain, with root-relative URLs.
    • Developing with HTTPS on your own machine.
    • Setting up a new development computer.

    Apache Virtual Host Generator FAQ

    Which domain ending should I use?

    .test or .localhost: they are reserved for local use and never resolve on the internet. Avoid .dev, which browsers force to HTTPS, and .local, which macOS uses for Bonjour.

    Why does localhost show a different site?

    Apache uses the first virtual host as the default. The generator adds a localhost entry first so http://localhost keeps working.

    Where is the hosts file?

    C:\Windows\System32\drivers\etc\hosts on Windows and /etc/hosts on macOS and Linux. Editing it needs administrator rights.

    Which folder should DocumentRoot point to?

    The folder containing index.php: public for Laravel and Symfony, the project root for WordPress.

    How does local HTTPS work?

    mkcert creates a local certificate authority trusted only by your computer and issues certificates for your local domains, so browsers show no warning.

    Is anything uploaded?

    No. Everything is generated in your browser.

    Local sites with their own domains

    Out of the box, XAMPP and similar stacks serve every project from one document root, so projects live at addresses such as localhost/shop. That breaks root-relative links, cookies are shared between projects, and frameworks that expect to be at the domain root need extra configuration. Giving each project its own local domain solves all of this.

    Two pieces work together. Apache virtual hosts map a domain name to a project folder; the hosts file tells your computer that the domain points to 127.0.0.1. The generator writes both: a VirtualHost block per site with DocumentRoot, directory permissions and per-site logs, and the matching IPv4 and IPv6 hosts lines.

    Details depend on the stack, so the output uses the right paths for XAMPP on Windows or macOS, WampServer or Apache on Debian and Ubuntu, and the steps explain where the configuration goes, how to make sure Apache includes it, how to edit the hosts file and how to restart Apache.

    Windows paths are written with forward slashes, which Apache accepts and which avoids escaping problems. AllowOverride All enables .htaccess files, which WordPress and Laravel rely on for pretty URLs, and the first virtual host keeps localhost working.

    For HTTPS, the steps use mkcert to create certificates that only your computer trusts, and the configuration switches each site to port 443 with an HTTP redirect, so you can test secure cookies, service workers and other HTTPS-only features locally.

    Other useful tools