How to properly add an apache sites-enabled config
I am currently modifying an apache2 server and all I basically have to do is to add a config file to the apache2/sites-enabled folder. But whenever I see an apache server all the config files in there aren't actually files but shortcuts and whenever you doubleclick them with an ftp software you just download a file. When I look at the file information it links to a file which is actually in the exact same spot as the shortcut. So here my questions:
Why are the configs in apache2/sites-enabled all displayed as shortcuts?
How do I properly add a config while which is displayed and which behaves the same as the 000-default.conf?
1 Answer
Why are the configs in
apache2/sites-enabledall displayed as shortcuts?
They are symbolic links. Debian (and Debian-based distributions such as Ubuntu and Raspbian) use these links to manage which site configurations are active at any given time for Apache on those systems.
How do I properly add a config which is displayed and which behaves the same as the 000-default.conf?
Typically /etc/apache2/sites-available is where the actual configuration files for Apache reside on Debian derived systems. a2ensite and a2dissite are used to control the creation/removal of these links.
If you wanted to create a new configuration file, you would normally:
Create a new
.conffile under/etc/apache2/sites-available.Run e.g.
sudo a2ensite example_sitefrom the command line (whereexample_siteis the name of the configuration file located in/etc/apache2/sites-available/without the.confextension.)
Regarding Step 2, you can also potentially create symbolic links manually with e.g. sudo ln -s /etc/apache2/sites-available/example_site.conf /etc/apache2/sites-enabled/.