Welcome
Welcome to the personal website of Sussex based web developer Karl Rixon.
Welcome to the personal website of Sussex based web developer Karl Rixon.
If you are using WHM and you try to edit your Virtualhost settings in your httpd.conf, you will find the following warning message:
1 | # DO NOT EDIT. AUTOMATICALLY GENERATED. IF YOU NEED TO MAKE A CHANGE PLEASE USE THE INCLUDE FILES. |
This is not the most helpful warning message. Your first thought is probably that “the include files” refers to the pre_main, pre_virtualhost and post_virtualhost includes, but obviously they are no use when you are trying to edit the Virtualhost settings themselves.
Looking a bit closer inside the Virtualhost blocks in httpd.conf, the following advice is uncovered:
1 2 | # To customize this VirtualHost use an include file at the following location # Include "/usr/local/apache/conf/userdata/std/2/username/domain.com/*.conf" |
This helps a bit, but it’s still not especially clear what you need to do. For one thing this file doesn’t exist, and even if you create it the Include line is commented – and the whole point of this exercise is that the http.conf file cannot be manually edited so you can’t just uncomment it!
For anyone with this problem, hopefully the following should explain the full process needed.
First create the file mentioned inside the Virtualhost block. Note that this will be dependent on your username and domain so don’t just copy and paste the path below!
1 | mkdir -p /usr/local/apache/conf/userdata/std/2/username/domain.com |
Navigate to the directory you just created:
1 | cd /usr/local/apache/conf/userdata/std/2/username/domain.com |
Create a configuration file using your editor of choice (filename must end in .conf), and add any settings you need:
1 | nano extra.conf |
Now to uncomment the include, run the following command:
1 | /scripts/ensure_vhost_includes --all-users |
This script will uncomment any Include lines in httpd.conf Virtualhost blocks where it finds at least one *.conf file in the relevant directory. It will restart Apache for you so no need to do that – your changes should be immediate.