Skip to main content

Editing IfModule mod_include.c on virtualhost permanently

Comments

9 comments

  • cPanelMichael
    Hello, You can review the following document for instructions on how to make custom changes within a Virtual Host for a single domain name: Modify Apache Virtual Hosts with Include Files - EasyApache 4 - cPanel Documentation Let us know if this helps. Thank you.
    0
  • SpaceCowboy
    Hi i understand that but those directories add the code right before closing and i need to add my code inside See include below:
    SSILegacyExprParser On Include /etc/apache2/custom.d/globalblacklist.conf <---LINE I NEED TO ADD HERE ... .. . .. <--- IT'S ADDING IT HERE INSTEAD
    0
  • cPanelMichael
    Hello, An include file's contents will override any value that exists in the primary configuration file, so you should be able to enter a full IfModule section in $includename.conf:
    SSILegacyExprParser On Include /etc/apache2/custom.d/globalblacklist.conf
    Thank you.
    0
  • SpaceCowboy
    Just tried it doesn't work. Created a file named include-globalblacklist.conf that contains:
    SSILegacyExprParser On Include /etc/apache2/custom.d/globalblacklist.conf
    /etc/apache2/conf.d/userdata/ssl/2_4/*username*/*domain*/include-globalblacklist.conf Did /scripts/rebuildhttpdconf Built /etc/apache2/conf/httpd.conf OK Then check new httpd.conf find the line:
    SSILegacyExprParser On
    Missing the include.
    0
  • SpaceCowboy
    Please test this. It's not working properly for me.
    0
  • cPanelMichael
    Hello, You aren't going to see the actual Include line in the httpd.conf file. It's utilized based on the existence of the following line:
    Include "/etc/apache2/conf.d/userdata/ssl/2_4/$username/$domain/*.conf
    Could you let us know the contents of the /etc/apache2/custom.d/globalblacklist.conf file, and the specific method you are using to test it on the website after making the change? Thank you.
    0
  • SpaceCowboy
    Hello, You aren't going to see the actual Include line in the httpd.conf file. It's utilized based on the existence of the following line:
    Include "/etc/apache2/conf.d/userdata/ssl/2_4/$username/$domain/*.conf
    Could you let us know the contents of the /etc/apache2/custom.d/globalblacklist.conf file, and the specific method you are using to test it on the website after making the change? Thank you.

    Hi this is the file: github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/blob/master/conf.d/globalblacklist.conf I cannot put it on
    Include "/etc/apache2/conf.d/userdata/ssl/2_4/$username/$domain/*.conf
    Because it will break apache. That include adds the file before closing virtual host and i need it to be included here:
    SSILegacyExprParser On Include /etc/apache2/custom.d/globalblacklist.conf <---LINE I NEED TO ADD HERE
    0
  • cPanelMichael
    Hi this is the file: github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/blob/master/conf.d/globalblacklist.conf

    Hello, You can modify the default Virtual Host template using the following steps: 1. Copy the Apache 2.4 default vhost template for to allow for customization:
    cp -a /var/cpanel/templates/apache2_4/vhost.default /var/cpanel/templates/apache2_4/vhost.local
    2. Edit /var/cpanel/templates/apache2_4/vhost.local using the editor of your preference (e.g. vi, nano) to change the entries to match your preferences. For example, you can change this entry:
    SSILegacyExprParser On
    With:
    SSILegacyExprParser On [% IF vhost.servername == 'yourdomain.tld' -%] Include /etc/apache2/custom.d/globalblacklist.conf [% ELSE -%] # Include /etc/apache2/custom.d/globalblacklist.conf [% END -%]
    Ensure to replace "yourdomain.tld" with the domain name you want the change to apply to. 3. Save the changes to the file, and then run:
    /scripts/rebuildhttpdconf
    Note: You will need to complete the same steps for /var/cpanel/templates/apache2_4/ssl_vhost.default if you want to make the changes for the default SSL Virtual Host template. Let us know if this helps. Thank you.
    0
  • SpaceCowboy
    Thanks this worked, solved!
    0

Please sign in to leave a comment.