I already setup a conf for a site in the /etc/httpd/sites-available
. However, I am wondering how can I enable this, like a2ensite
in Debian, wherein the conf file will appear in the sites-enabled?
Asked
Active
Viewed 4.2k times
7

fishcracker
- 191
- 1
- 2
- 6
-
Use `vhosts.d` directory instead. `sites-enabled` and `sites-available` is a Debian-only thing. – sebix Apr 20 '17 at 10:12
2 Answers
13
Mimicking the Debian config system isn't difficult.
- In your Apache config, you have to include every
*.conf
file in/etc/httpd/sites-enabled
with the directiveInclude sites-enabled/*.conf
. - Add the config to a
*.conf
file in/etc/httpd/sites-available
. - Activate the site in the config file by creating a link from the relevant file in
/etc/httpd/sites-available
into/etc/httpd/sites-enabled
, which is basically the only thing thata2enable
does on Debian.
-
-
Please add the failure messages (and your current config, if possible) to your question. – Sven Jan 28 '13 at 10:45
-
To clarify a bit, you need to edit your httpd.conf the directive to include the files in /etc/httpd/sites-enabled/. I have specified only the ones with a .conf extension using the following directive "Include sites-enabled/*.conf". You could also script a script to create and break the the link. – flickerfly Aug 06 '14 at 19:42
0
Activate:
ln -s /etc/httpd/sites-available/mysite.com /etc/httpd/conf.d/mysite.com
Deactivate:
unlink /etc/httpd/conf.d/mysite.com

Bart De Vos
- 17,911
- 6
- 63
- 82
-
1I'm not sure why this was downvoted, perhaps because it doesn't include the step to actually bring those files into the config? What is here is accurate though. Also, unlink and rm are fundamentally the same. I avoid unlink as I've not come up with a scenario where it is better aside from an extremely small potential performance improvement. Details: http://serverfault.com/questions/38816/what-is-the-difference-between-unlink-and-rm – flickerfly Aug 06 '14 at 19:47