# Virtual Host for Laravel with apache2

You have new Linux PC with fresh apache2 installation. Now you don't know how to point to your Laravel site? Let's follow the below steps.

Add your desired domain name in /etc/hosts (example: myblog.test you can give anything here and you should put it exact same in the virtual host config ServerName option)

```bash
127.0.0.1    myblog.test
```

apache2 virtual host config. Add this to /etc/apache2/sites-available/000-default.conf

```bash
<VirtualHost *:80>
    ServerName myblog.test
    DocumentRoot "path/to/laravel/public"

    <Directory "path/to/laravel/public">
        AllowOverride Al
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>
```

Replace this path (**path/to/laravel/public**) with your project path

Enable mod\_rewrite if not enabled

```bash
sudo a2enmod rewrite
```

Now restart the apache2 server

```bash
sudo service apache2 restart
```
