How to disable VirtualHost creation for a specific domain?
Hi. For one of my domains, I need a heavily customized VirtualHost.
Everytime the system updates or there's an EasyApache thing run, a new VirtualHost entry is created for me in the freshly revised httpd.conf file.
Fortunately I have my VirtualHost customized in the post_virtualhost_2.conf file already. Including this file is the last line in the httpd.conf file.
But it seems that if httpd.conf and then the virtualhost_2.conf both have the same VirtualHost directive for my domain (the httpd.conf being the default stuff that EasyApache writes, and the post_virtualhost_2.conf with all my heavy customization) then only the first one is taken into account by Apache!
SO I have two options:
1. Somehow tell EasyApache NOT to create a VirtualHost for one domain. It can create the VirtualHost stuff for other domains in my WHM because for them default settings are OK. Just the one domain which I want to be left out, and instead have the VirtualHost for that domain picked up from the post conf file.
2. Or, I can somehow make Apache respect the *second* VirtualHost declaration of the same domain, which is included via the post_virtualhost_2.conf file.
Any ideas on how to solve for this in a future-proof way? Thanks!
-
Hello, You should probably try using the VirtualHost configuration section instead. This can be created under: /usr/local/apache/conf/userdata/std/2_x/$USER/$domain.conf (x is either 2 or 4 (depending on your version of Apache)
Documentation on this is Modify Virtualhost Containers With Include Files.0 -
Thank you. But in my server the '.../userdata/2.2" does not exist. Should I just create that folder, and put a file in there? 0 -
That is correct, you must create the directories. 0 -
This is an include file. Which means the VirtualHost will be created for this domain in the httpd.conf, and my specified custom include file will be included in that VirtualHost. This is not what I want: [QUOTE]Includes are the last directives in each virtualhost container. A directive or value that is in an include file will override any value that exists in the primary configuration file.
What I want is that for the VirtualHost for one domain to be *entirely* created from a file. Not to have a VirtualHost created, and only an include file included at the end of it. How to do that? (The other option is to create a "Custom Template" for *all* virtualhosts, which is also *not* what I'm looking for. )0 -
Hello :) Would a custom template that is applied to a single VirtualHost be of help? That is documented here: How to create a custom template that will apply to a single virtual host Thank you. 0
Please sign in to leave a comment.
Comments
5 comments