# Apache vhost template (docs-localhost.conf.template)

This directory contains a template for an Apache VirtualHost configuration for local Laravel development.

Usage

1. Replace `{{REPO_PATH}}` with the path to your project root (example: `/var/www/docs`) or use the `scripts/install-vhost.sh` script to automate the install.

2. Copy the generated vhost to /etc/apache2/sites-available/ and enable it:

```bash
# as root or with sudo
sudo cp apache/docs-localhost.conf.template /etc/apache2/sites-available/docs-localhost.conf
# replace placeholder (if you didn't replace using script)
sudo sed -i 's|{{REPO_PATH}}|/var/www/docs|g' /etc/apache2/sites-available/docs-localhost.conf
sudo a2enmod rewrite
sudo a2ensite docs-localhost.conf
sudo systemctl reload apache2
```

3. Add the hosts entry to your `/etc/hosts` if not present:

```bash
sudo -- sh -c "echo '127.0.0.1 docs.localhost' >> /etc/hosts"
```

4. Open `http://docs.localhost/` in your browser. If you see directory listing or `public` is required in the URL, double-check the `DocumentRoot` value and that `AllowOverride All` is configured.

Optional

- If you use PHP-FPM, adjust the `FilesMatch` block or use `SetHandler` to proxy to the FPM socket (example shown in template).
- If you want HTTPS locally, create or point to a self-signed cert and use the SSL block.

Security note

- This template is intended for local development only. Do not use it unchanged in production.

Tip: If you get a 403 Forbidden on HTTPS after installing the vhost, check the DocumentRoot has the correct path and that the `public` folder and all parent directories are readable (execute permission) by the webserver user (usually `www-data` on Ubuntu). You can run the helper script `scripts/fix-perms.sh` to set common permissions for the `storage` and `bootstrap/cache` directories.
