EasyApache4 and custom templates
I need to add some custom configuration to a virtual host. I'm running WHM 58.0 (build 28)
This server is using EasyApache4 and this is my first server I've used with that.
I started by looking at the Apache config file here: /usr/local/apache/conf/httpd.conf
In each of the Virtual host sections these lines are there.
# To customize this VirtualHost use an include file at the following location
# Include "/etc/apache2/conf.d/userdata/std/2_4/chan/mysite.com/*.conf"
This is different than the past with the userdata directory under the apache config.
Looking at the documentation for EasyApache4, there is no section for using these custom templates like there is in EasyApache3 and the EasyApache3 documentation has different directories shown.
Modify Virtualhost Containers With Include Files - EasyApache - cPanel Documentation
Also, in the top of the Apache httpd.conf file, there used to be a part stating what commands to run to keep changes, i.e. distiller
This new EasyApache4 httpd.conf file has no information other than ANY changes will be overwritten.
The /etc/apache2/conf.d/userdata directory structure didn't exist, so I created it, but if I can't remove the # remark in front of the virtual host config include line in the main httpd.conf file and keep the change, how will the custom configuration stay live? Thanks, Chuck
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# DO NOT EDIT. AUTOMATICALLY GENERATED. USE INCLUDE FILES IF YOU NEED TO MAKE A CHANGE
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#
# Direct modifications to the Apache configuration file WILL be lost upon subsequent
# regeneration of this configuration file, or an Apache update.
#
# To have your modifications retained, you should create/edit administrator-specific
# include files:
#
# /etc/apache2/conf.d/includes/pre_main_global.conf
# /etc/apache2/conf.d/includes/pre_virtualhost_global.conf
# /etc/apache2/conf.d/includes/post_virtualhost_global.conf
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
The /etc/apache2/conf.d/userdata directory structure didn't exist, so I created it, but if I can't remove the # remark in front of the virtual host config include line in the main httpd.conf file and keep the change, how will the custom configuration stay live? Thanks, Chuck
-
Create the directory structure mkdir -p /etc/apache2/conf.d/userdata/std/2_4/chan/mysite.com
Then create/modify whatever configuration additions you want to make for mysite.com using whatever command line editor you like/etc/apache2/conf.d/userdata/std/2_4/chan/mysite.com/custom.conf
Then enable that section of code to be read by the httpd.conf file/scripts/ensure_vhost_includes --user=chan
For what it's worth, the configuration paths changed in EasyApache4 from EasyApache3. In EasyApache3, these userdata directories were located in /usr/local/apache/conf/userdata/std/2/%user%/%domain% in EasyApache4 these changed to /etc/apache2/conf.d/userdata/std/2_4/%user%/%domain%0 -
Awesome! It works. The command I couldn't find in the docs was the /scripts/ensure_vhost_includes Thank you for your help. Chuck 0 -
Hello, I'm happy to see the information you were provided helped. Thank you for updating us with the outcome. 0
Please sign in to leave a comment.
Comments
3 comments