Share via:

Create Symbolic Link to V-host .conf File in Sites-Available

How to create symbolic links for Apache2 v-host files in sites-available.


Edited: 2019-10-03 14:07

This is just a simple quick-reference on how to easily create a symbolic link to a v-host file in the sites-available directory when configuring apache. Simply navigate to the sites-enabled directory, and use the ln -s command as shown below.

cd /etc/apache2/sites-enabled
sudo ln -s /etc/apache2/sites-available/subdomain-example-com.conf

Doing this will create a symbolic link in sites-enabled. The link is pointing to the file in the sites-available directory.

Multiple v-host files vs one big file

When hosting multiple sites with the same Apache2 HTTP server, you would typically maintain a separate v-host file for each site, because this may allow your to more easily access the settings of each site.

It is also possible to keep all sites in the same file, often this file will be called 000-default.conf.

Note. Using one big file has caused problems with letsencrypt, which for some reason does/did not support one-big-file. You should therefor check if this situation has changed if you plan to use letsencrypt with multiple sites on the same server.