# 🔌 | Connect Dashboard - DJS Bot - Ubuntu - Apache

---

# 1. 

> ##### Go to your DNS Registrar - E.G Namecheap, Google Domains, Namecom etc....

For this example i will be using [Cloudflare](https://www.cloudflare.com/en-gb/)

---

# 2.


> ##### Locate your DNS Records


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1668104209190/mvCRkv8_P.png align="left")

---

# 3.

> ##### Add an "A Record"


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1668104299498/4IVvYd-Im.png align="left")

> ##### With the following information

| Name      | IPV4 Adress |
| ----------- | ----------- |
| Subdomain or @ to use the whole domain      | your servers IPV4 Adress      |


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1668104547518/QwVvKB-Ox.png align="left")

---

# 4.

> ##### You will need to be able to access your servers terminal for these following steps

```bash
$  sudo apt update

$  sudo apt install apache2
```

> ##### List the ufw application profiles by typing:

```bash
$  sudo ufw app list
```

> ##### You will receive a list of the application profiles:

```bash
Output
Available applications:
  Apache
  Apache Full
  Apache Secure
  OpenSSH
```

> ##### As indicated by the output, there are three profiles available for Apache:

Apache: This profile opens only port 80 (normal, unencrypted web traffic)

Apache Full: This profile opens both port 80 (normal, unencrypted web traffic) and port 443 (TLS/SSL encrypted traffic)

Apache Secure: This profile opens only port 443 (TLS/SSL encrypted traffic)

---

# 5.

> ##### Enable the following Apache Modules

```bash
$  sudo a2enmod proxy
$  sudo a2enmod proxy_http
$  sudo a2enmod proxy_balancer
$  sudo a2enmod lbmethod_byrequests
```

> ##### Restart Apache

```bash
$  sudo systemctl restart apache2
```

# 6.

> ##### Configuring our webserver


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1668105558953/doaPFoXH_.png align="left")

```bash
$  cd /etc/apache2/sites-available
```

> ##### Once you run `ls` you should see 000-default.conf


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1668105642911/n_ltZ0oTO.png align="left")

> ##### Copying the default configuration

```bash
$  cp 000-default.conf dashboard.conf
```

```bash
nano dashboard.conf
```

> ##### Edit the default configuration to the below configuration

```bash
<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerName yourdomain.com
        ProxyRequests On
        ProxyPreserveHost On

        ProxyPass / http://localhost:8080/ # <-- Change the port if your bot is running on a different port
        ProxyPassReverse / http://localhost:8080/

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>
```

> ##### Press `CTRL + X` or `Command-X` for Mac then press Enter to save changes

> ##### Now run the following command

```bash
$  a2ensite dashboard.conf
```

```
$  systemctl reload apache2
```

---

# 7.

> ##### Setting up our Discord application redirect

> ##### Go to https://discord.dev and go to your application -> Oauth2 -> General

> ##### Add 2 Redirects with the following contents



![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1668812746494/UGjM9bOpl.png align="left")

##### important -> Change http and https depending if you have SSL or not!

---

# 8.

> ##### Now you should be able to access and login to your bots dashboard!

---

## Optional: Setting up SSL

> ##### https://certbot.eff.org/instructions?ws=apache&os=ubuntufocal

---

[![download.png](https://i.postimg.cc/02354Q4h/download.png)](https://postimg.cc/BXTGLq4C) Written by [River](https://riverdev.wtf)

CEO @ [AIO Tech Ltd](https://aiodiscord.xyz)

CEO @ [Seven Seas Hosting](https://id.sevenseas.cloud)

---








