Configuring Subdomains Apache


  • One A DNS Record for *
  • One A DNS Record for

Configuring sub-domain

Apache’s main web folder is /var/www/. There should already be the folder html in here. For this example, we’ll pretend we want to make the subdomain:

  • First, you’ll want to create a directory in /var/www/ called “test” using mkdir -p /var/www/test/.
  • Next, you’ll want to go to: /etc/apache2/sites-available/. In here there is a file called 000-default.conf. You will want to copy this file in the same directory, and name it: in our case.
  • In this file, you’ll want to have the following code:
DocumentRoot /var/www/test
<Directory /var/www/test/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
ErrorLog /error.log
CustomLog /access.log combined
  • Then you’ll want to enable the subdomain: a2ensite
  • Finally, you’ll want to do a reload on the apache service to make sure the changes come through. systemctl reload apache2

Now you should be good to go with your new subdomain!




Learning, and posting my findings!

Love podcasts or audiobooks? Learn on the go with our new app.

For Loops in Python

What’s New in EF Core?

Calculating Great Circle Distances in Python

Google Summer of Code: First Evaluation

How is GitLab’s DevOps Product Different?

Introduction to Anypoint Connectors

Virtual Reality: See it to believe it

Regular Expressions

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Matthew Boyd

Matthew Boyd

Learning, and posting my findings!

More from Medium

Introduction to Elastic Stack

Container certification using Travis CI

Kubernetes, for software developers (part 2)

RH-SSO with Oracle Back-end Database