# 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>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.devhub.com/hosting-options/server-path-override/apache-configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
