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.

Including additional Conf files

Discussion in 'General Discussion' started by NightStorm, Nov 14, 2005.

  1. NightStorm

    NightStorm Well-Known Member

    Joined:
    Jul 28, 2003
    Messages:
    286
    Likes Received:
    4
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Twitter:
    I want to add the ability to have my httpd.conf file include any *.conf files located inside the /home/<domain>/conf folder for the sites. This is an option that is available with Plesk, for adding additional lines to the sites VirtualHost setting, or whatever else (custom rules, essentially), but are owned by the server admin (so the customers do not have access to this section).
    Is this an option available in Cpanel? Like, if I add a conf directory with the vhost.conf file inside it into the Skeleton directory, will I break Cpanel's settings if I set Apache to include this directory in it's calls?
     
  2. ntwaddel

    ntwaddel Well-Known Member

    Joined:
    Nov 3, 2003
    Messages:
    173
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Templeton, CA
    well you could do something like

    Include /home/*/conf/*.conf

    I believe. But their virtualhost is still going to reside in the httpd.conf, so you cant just duplicate it

    it would be nice if cpanel changed their setup to put each users vhost config files in their home dir like that
     
  3. NightStorm

    NightStorm Well-Known Member

    Joined:
    Jul 28, 2003
    Messages:
    286
    Likes Received:
    4
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Twitter:
    Okay, I got it sort of figured out. But what file do I edit to add an additional line into the VirtualHost directive for cpanel on creation? Or, does anyone know what I need to adjust in postwwwacct in order to make this add an Include instead of a Userdir?
    Code:
    sub edit_httpd {
    
    system("cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.prescript");
    
    open(datafile,"/usr/local/apache/conf/httpd.conf");
    @lines = <datafile>;
    close(datafile);
    
    foreach $l (@lines) {
    chomp($l);
    }
    
    open(datafile,">/usr/local/apache/conf/httpd.conf");
    flock (datafile,2);
    seek (datafile,0,0);
    foreach $l (@lines) {
    
    if ($l =~ "UserDir enabled") {
    $l = $l . " " . @ARGV[1];
    }
    
    print datafile "$l\n";
    }
    close(datafile);
     
Loading...

Share This Page