The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

ensure_vhost_includes doesn't work half the time

Discussion in 'General Discussion' started by jerrek71, Jun 7, 2008.

  1. jerrek71

    jerrek71 Active Member

    Joined:
    Jul 27, 2006
    Messages:
    42
    Likes Received:
    1
    Trophy Points:
    6
    Hello,
    I'm getting increasingly frustrated with this script. Sometimes it just doesn't work. I follow the instructions to the letter and have created the following directory with a .conf file;

    Code:
    /usr/local/apache/conf/userdata/std/2/kabarty/services.kabarty.com/stuff.conf
    
    services.kabarty.com is a subdomain owned by user kabarty

    I run
    Code:
    /scripts/ensure_vhost_includes --user=kabarty
    
    And nothing happens. No changes to httpd.conf at all. All it says, every time, is that jsp support is enabled for kabarty now.

    Sometimes if I run the distiller it'll put the vhost includes in, other times it doesn't.. It seems to be a bit random to be quite honest. Is there anywhere I can look to see what it thinks it's doing.

    I also ran
    Code:
    /scripts/verify_vhost_includes
    
    which told me that the stuff.conf file I want to include was syntactically OK... If that script can see it, why can't the one that's supposed to add it to my httpd.conf see it?

    So far I'm not real thrilled with this new way of doing things!! (Edit: Actually - I am pretty much - see post below :))
     
    #1 jerrek71, Jun 7, 2008
    Last edited: Jun 7, 2008
  2. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,384
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Search through the httpd.conf file for services.kabarty.com. First make sure there is only one VirtualHost container for this virtualhost. Then see what the ServerName for this VirtualHost container is. This is what you have to use in the directory structure under the kabarty directory.

    I really think that what you have listed is correct, but this is the only suggestion that I can think of. This subdomain may be referring to an addon domain, for example test.com. If you search through the httpd.conf and you find the VirtualHost container for services.kabarty.com and the ServerName for that container is test.com then you would need to create the directory:

    /usr/local/apache/conf/userdata/std/2/kabarty/test.com

    This is just a suggestion that you might want to look into.
     
  3. jerrek71

    jerrek71 Active Member

    Joined:
    Jul 27, 2006
    Messages:
    42
    Likes Received:
    1
    Trophy Points:
    6
    Ah, you may have hit the nail on the head there... There's two VirtualHost containers, one is on port 80, and one is on port 443 - this virtualhost is an SSL enabled virtualhost..

    I wonder if the ensure_vhost_includes doesn't work for SSL hosts?

    For now I have added the Include directive manually and distilled it - I'm not sure if it'll hold after an update because I don't think the distiller will look at VirtualHost directives but we'll see... At least it's working.

    Incidentally, cPanel 11 is, in general, a superb improvement over previous versions. I've just gone through a major server migration, moving a hundred or so customers and it was smooth as silk - plus the new 'point account on old server to new server' (or 'Express Transfer tick box) is an absolute God send. And easyapache 3 is nice - this little niggle I have with the vhost includes is so far the only thing I can find fault with cPanel 11 for :)

    Thanks for the suggestion sparek - I reckon it's cause there's an SSL VHost for that name too.

    Regards,
    J.
     
  4. jerrek71

    jerrek71 Active Member

    Joined:
    Jul 27, 2006
    Messages:
    42
    Likes Received:
    1
    Trophy Points:
    6
    DUH, what was I thinking - if it's an SSL container I need to put it in the SSL subdirectory... :eek:

    I shall go try that now!
     
  5. jerrek71

    jerrek71 Active Member

    Joined:
    Jul 27, 2006
    Messages:
    42
    Likes Received:
    1
    Trophy Points:
    6
    OK, so it half worked by putting it in the SSL subdirectory :)

    The SSL VHost now has the necessary include - but the non-ssl VHost with the same name doesn't. It's actually not a big deal because this host should always get called by it's https:// prefix anyway - but it'd be nice not to have to for some things...

    Anyway, thanks again Sparek!
    J.
     
  6. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    16
    Wow, this is a really elegant system. I've got it working nicely for a file full of redirects :

    /etc/httpd/conf/userdata/std/2/journ/domain.com/redirects.conf
    Now I add a 2nd file:
    /etc/httpd/conf/userdata/std/2/journ/domain.com/other.conf

    other.conf contains only :
    Code:
    ErrorDocument 404 /etc/404.php
    I restart apache and... the ErrorDocument is not recognized - I just get the standard apache 404 page.

    /scripts/verify_vhost_includes
    recognized both files and says both are OK.

    Any idea why one of these files is working fine but the other is not? (yes, I know I can do this with .htaccess but would prefer not to - and need to understand this system well).

    Thanks,
    Scot
     
  7. cPDan

    cPDan cPanel Staff
    Staff Member

    Joined:
    Mar 9, 2004
    Messages:
    711
    Likes Received:
    4
    Trophy Points:
    18
    Is the include in the vhost in question? (rebuild httpd.conf should get it added if its not)

    If so, are you 100% sure the URL in question resolves to that vhost?
     
  8. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    16
    Hi cpdan -

    Yep, I'm sure the include is there in httpd.conf, and it's including *.conf. Again, there are two files in the dir -- redirects.conf and other.conf. redirects.conf works fine, the other gets ignored.

    Thanks,Scot
     
  9. jerrek71

    jerrek71 Active Member

    Joined:
    Jul 27, 2006
    Messages:
    42
    Likes Received:
    1
    Trophy Points:
    6
    My guess here would be that it's not a vhost_includes problem but a standard apache problem... I don't think Apache will like running a php script from /etc - especially if you're running something like suhosin and/or suphp.

    The ErrorDocument (if it has to be a php script) will need to be somewhere in the users home directory, and owned by the user - if you're running suphp anyway. Owned by user nobody if you're not running suphp.

    If you're not running suphp or suhosin I'd still shy away from putting any PHP scripts in /etc

    You may find the Apache error_log (/usr/local/apache/logs/error_log) gives you some insight too.

    Hope that helps,
    J
     
  10. cPDan

    cPDan cPanel Staff
    Staff Member

    Joined:
    Mar 9, 2004
    Messages:
    711
    Likes Received:
    4
    Trophy Points:
    18
    ErrorDocument is a URI not a file system path

    so http://fiddle.sticks/i_dont_exist.html would 404 to http://fiddle.sticks/etc/404.php

    not be trying to execute /etc/404.php, it'd really translate to something like:

    /home/fiddle/public_html/etc/404.php

    Indeed, excellent advice :)
     
  11. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    16
    D'oh! Of course that was it. And I should have known, since the /etc path has tripped me up in other areas as we're moving to a cPanel server with mod_security running (via ConfigServer's excellent security setup). Changing that path to /misc fixed it right up.

    Thanks.
     
Loading...

Share This Page