Skip to main content

VirtualHost Targeting With Include Files

Comments

6 comments

  • cPRex Jurassic Moderator

    Hey hey!  Can you let me know specifically what you've tried to enter there that isn't working?  The include system has been in place for a very long time, and I'm not aware of any issues with the files just not being read.

    1
  • vatra

    Hey! Let me do a few more tests and I'll get back to you with exact specifics.

    0
  • vatra

    These are the results of testing:

    /ssl/file.conf  <==  NOT included
    /ssl/2_4/file.conf <== included

    So, include files without the Apache version in the path do not get included in httpd.conf.

    Also, this doesn't work as well. I don't know if this is even a functionality, to modify both SSL and non-SSL hosts under the same user:

    /user/file.conf
    0
  • cPRex Jurassic Moderator

    That seems like it would be the correct behavior - if it's not one of the Apache versions, it's more of a "for your own reference" type of thing.

    Let's look at the actual Apache conf.  At the end of each vhost, we have this include file listed, along with a corresponding comment:

    Include "/etc/apache2/conf.d/userdata/std/2_4/username/domain.com/*.conf"

    # To customize this VirtualHost use an include file at the following location
    # Include "/etc/apache2/conf.d/userdata/std/2_4/username/domain.com/*.conf"

    so if you aren't using a file inside /etc/apache2/conf.d/userdata/std/2_4/username/domain.com/, I wouldn't expect it to be added.

    The SSL vhost shows corresponding data, just with the "std" replaced with the "ssl" path:

    Include "/etc/apache2/conf.d/userdata/ssl/2_4/username/domain.com/*.conf"

    # To customize this VirtualHost use an include file at the following location
    # Include "/etc/apache2/conf.d/userdata/ssl/2_4/username/domain.com/*.conf"

    so I would expect you to need to customize both, depending on what you are doing, and if you want it applied to both the secure and insecure vhost.

    As an example, WP Toolkit places an include file both the 80 and 443 vhosts include directory for each domain:

    [root@host]# ll /etc/apache2/conf.d/userdata/std/2_4/username/domain.com/
    total 12K
    drwxr-xr-x 2 root root 4.0K Feb 17  2023 .
    drwxr-xr-x 3 root root 4.0K Feb 17  2023 ..
    -rw-r--r-- 1 root root 1.7K Feb 17  2023 wp-toolkit.conf

    [root@host]# ll /etc/apache2/conf.d/userdata/ssl/2_4/username/domain.com/
    total 12K
    drwxr-xr-x 2 root root 4.0K Jan  1 22:44 .
    drwxr-xr-x 3 root root 4.0K Feb 17  2023 ..
    -rw-r--r-- 1 root root 1.7K Feb 17  2023 wp-toolkit.conf

     

    1
  • vatra

    Thank you for the analysis Rex,

    that is exactly my experience and conclusion. At least we know now.

    0
  • cPRex Jurassic Moderator

    You're welcome!

    1

Please sign in to leave a comment.