> For the complete documentation index, see [llms.txt](https://docs.devhub.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devhub.com/hosting-options/server-path-override/apache-configuration.md).

# Apache configuration

Subdirectory Proxy Configuration for (Apache) servers

## Step 1: Enable mod proxy on the server

Mod proxy is required for routing traffic to your Proxy

```
# enable apache module for proxy
sudo a2enmod proxy
sudo a2enmod proxy_http

# restart apache
/etc/init.d/apache2 restart
```

## Step 2: Modify sites-available config file

Below is an example of configuring your Apache server VirtualHost entry to route traffic for some paths within your existing domain.

The two items you will need to edit:

1. Make sure the `ProxyPreserveHost On` is included in the `VirtualHost` entry.
2. Add the custom `<Location>` directives that will be provided by us. An example of these can be found below.

```
<VirtualHost *:80>
ServerName customerdomain.com
# continue existing VirtualHost configuration items..

ProxyPreserveHost On

# at beginning of your existing <Location> directive rules

ADD_YOUR_LOCATION_DIRECTIVES here

# continue existing configuration items..
</VirtualHost>
```

## Example Location directives

This is just an example of the location directives that would be added to serve the path and some of the other assets (styles, images, etc) from our platform. The specific Location directives you will install will be provided by us.

```
<Location /your-path/>
RequestHeader set Host customerdomain.com
ProxyPass http://255.255.255.255:80/your-path/
Order allow,deny
Allow from all
</Location>
<Location /style/>
RequestHeader set Host customerdomain.com
ProxyPass http://255.255.255.255:80/style/
Order allow,deny
Allow from all
</Location>
<Location /img/>
RequestHeader set Host customerdomain.com
ProxyPass http://255.255.255.255:80/img/
Order allow,deny
Allow from all
</Location>
<Location /stat/>
RequestHeader set Host customerdomain.com
ProxyPass http://255.255.255.255:80/stat/
Order allow,deny
Allow from all
</Location>
```
