> For the complete documentation index, see [llms.txt](https://kchuene.gitbook.io/data-communication-project/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kchuene.gitbook.io/data-communication-project/archive/domain-names.md).

# Domain Names

Configuring domain names for connected nodes for ease of use.

## Apache Virtual Hosting

We will take advantage virtual hosting feature in Apache to configure a primary domain name for **DVWA** web application.

**Access DVWA Container**

{% code overflow="wrap" lineNumbers="true" %}

```
sudo docker exec -it dvwa bash
```

{% endcode %}

**Create sites-available entry**

Navigate to `/etc/apache2/sites-available` and create a config file for the domain you want to assign, i.e. `www.dvwa.com.conf`&#x20;

{% code overflow="wrap" lineNumbers="true" %}

```
cd /etc/apache2/sites-available
touch www.dvwa.com.conf
```

{% endcode %}

Edit the config to specify

{% code overflow="wrap" lineNumbers="true" %}

```
<VirtualHost *:80>
   ServerName www.dvwa.com
   DocumentRoot /var/www/html/
   
   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log Combined
   
   <!-- Default file to look for in DocumentRoot -->
   <IfModule mod_dir.c>
      DirectoryIndex index.php
   </IfModule>
</VirtualHost>
```

{% endcode %}

Since neither `vim` nor `nano` are installed the following command can be run to still edit

{% code overflow="wrap" lineNumbers="true" %}

```
tee www.dvwa.com.conf <<EOF
```

{% endcode %}

Alternatively you can use a read-only bind mount, serving the config from the host filesystem. Or serve it via a temporary python HTTP server.

{% hint style="info" %}
When inputting `${APACHE_LOG_DIR}` via the **tee** command escape the `$` (dollar) like so `\$`
{% endhint %}

{% hint style="info" %}
**DVWA** files come installed in the `/var/www/html` web directory.
{% endhint %}

**Set the ServerName globally**

Edit the `/etc/apache2/apache2.conf` file to globally declare the server name and avoid error `AH0058`&#x20;

{% code overflow="wrap" lineNumbers="true" %}

```
ServerName www.dvwa.com
```

{% endcode %}

**Enable available site and Reload config**

{% code overflow="wrap" lineNumbers="true" %}

```
sudo a2ensite www.dvwa.com 
```

{% endcode %}

{% code overflow="wrap" lineNumbers="true" %}

```
sudo systemctl reload apache2
```

{% endcode %}

{% hint style="info" %}
The command `apache2ctl -t` can help with finding errors in configuration.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://kchuene.gitbook.io/data-communication-project/archive/domain-names.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
