Introduction
Apache configuration directives have certain contexts associated with them. The contexts that are associated with a directive determine where a directive can exist. You can read more about contexts in the apache documentation.
There are some Apache directives that need to be set within the virtualhost context. If you need to add a directive to the virtualhost context, you would need to use the method described in this article to do so.
This method is based on the following documentation:
Modify Apache Virtualhosts with Includes
Procedure
- 1. Login to the server via SSH as the root user
- 2. Issue the following commands, replacing the username and domain as appropriate for your situation. The username and domain portion are in all capital letters in this example to highlight what needs to be changed. Please use all lowercase letters when running the command on your server.
mkdir -p /etc/apache2/conf.d/userdata/ssl/2_4/CPANELUSERNAME/DOMAIN.TLD/
mkdir -p /etc/apache2/conf.d/userdata/std/2_4/CPANELUSERNAME/DOMAIN.TLD/
touch /etc/apache2/conf.d/userdata/ssl/2_4/CPANELUSERNAME/DOMAIN.TLD/include.conf
touch /etc/apache2/conf.d/userdata/std/2_4/CPANELUSERNAME/DOMAIN.TLD/include.conf - 3. Edit those newly created files so that they contain your desired directives
- 4. Rebuild the apache configuration so that those includes will be added with the following command:
/usr/local/cpanel/scripts/rebuildhttpdconf
- 5. Restart Apache so that Apache will read the new configuration:
/usr/local/cpanel/scripts/restartsrv_httpd
References
cPanel Documentation - Modify Apache VirtualHosts with Includes
Comments
0 comments
Article is closed for comments.