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.

New accounts are not being created with the ScriptAlias directive in httpd.conf

Discussion in 'General Discussion' started by BianchiDude, Jul 14, 2005.

  1. BianchiDude

    BianchiDude Well-Known Member
    PartnerNOC

    Joined:
    Jul 2, 2005
    Messages:
    619
    Likes Received:
    0
    Trophy Points:
    16
    New accounts are not being created with the ScriptAlias directive in httpd.conf

    I have to add this line to all accounts manually:
    ScriptAlias /cgi-bin/ /home/username/public_html/cgi-bin/

    CGI IS CHECKED in the package,

    New Account info returns HasCGI = YES!
    | HasCgi: y
    | UserName: cditest
    | PassWord: testtest

    Why isnt it putting the ScriptAlias directive in httpd.conf????
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
  3. kemis

    kemis Well-Known Member

    Joined:
    Feb 17, 2005
    Messages:
    104
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Georgetown, TX
    I'm reviving this very old post because I have this exact same problem, but 3 years later.

    I always had to manually add the ScriptAlias directive to the httpd.conf, but now that I've upgraded to Apache2, all those were stripped out!!!

    As best I can tell, by looking at /var/cpanel/templates/apache2/vhost.default , Apache2 checks to see if I have mod_alias available (which is nowhere to be found anywhere during the EasyApache 3.2 process) and then checks some sort of "scriptalias" variable to see if it's set to "1".

    Here's that logic:
    Code:
    [% IF supported.mod_alias -%]
    [% IF scriptalias == 1 -%]
    ScriptAlias /cgi-bin/ [% vhost.documentroot %]/cgi-bin/
    [% END -%]
    [% END -%]
    Where is this setting it's looking at? I don't think it's the "HASCGI=1" option.

    The bottom line is that many of my accounts have the "HASCGI=1" set in their /var/cpanel/users/<username> settings file, yet not a single ScriptAlias exists in my httpd.conf file after upgrading to Apache2.

    Please help!
    Matt
     
  4. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    What do you have defined in Basic WHM/cPanel Setup for
    Code:
    * Automatically create a cgi-bin script alias. This setting can be individually overridden during account creation.
    
     
  5. kemis

    kemis Well-Known Member

    Joined:
    Feb 17, 2005
    Messages:
    104
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Georgetown, TX
    Oh yeah! I forgot about that setting.

    It is currently set to "n" with the expectation that individual "allow CGI" checkboxes would enable the feature for the account. But is this option *only* looked at during account creation?

    What is supposed to happen during account creation that's not happening now, during a /scripts/rebuildhttpdconf ?

    Thanks!
     
  6. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    If ScriptAlias is disabled in Basic WHM/cPanel Setup and CGI is disabled during account creation, then the VirtualHost is created with these entries and no ScritpAlias:

    Code:
        Options -ExecCGI -Includes
        RemoveHandler cgi-script .cgi .pl .plx .ppl .perl
    
    If ScriptAlias is disabled in Basic WHM/cPanel Setup and CGI is enabled during account creation, then ScriptAlias is not added and CGI remains enabled.

    Hence: the setting in Basic WHM/cPanel Setup governs the inclusion of ScriptAlias.

    The CGI setting in account and package creation determines whether CGI remains enabled.
     
  7. kemis

    kemis Well-Known Member

    Joined:
    Feb 17, 2005
    Messages:
    104
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Georgetown, TX
    To make sure I understand you correctly, I need to have the CGI script alias option in WHM Setup set to "y" if I easily want to use the check box in the WHM Account manager.

    Otherwise, when the CGI option in WHM Setup is set to "n", then checking the box in the account manager will have no effect at all (which is what's happening right now)?

    Assuming I go back & set the WHM Setup option to "y" & then run /script/rebuildhttpdconf, will all my ScriptAliases magically appear?

    Thanks so much,
    Matt
     
    #7 kemis, Jul 31, 2008
    Last edited: Jul 31, 2008
  8. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Yes, once you change the setting in Basic WHM Setup, rebuilding httpd.conf will set ScriptAlias appropriately.

    Code:
    root@mundane [~/tmp]# grep -i scriptalias -c /usr/local/apache/conf/httpd.conf
    765
    root@mundane [~/tmp]# /scripts/rebuildhttpdconf 
    [Cpanel::AdvConfig::apache]: Creating missing document root /home/hometest/data/hmscenar/public_html for hmscenar
    [Cpanel::AdvConfig::apache]: Creating missing document root /home/wherecre/home/isthiswr/public_html for isthiswr
    [Cpanel::AdvConfig::apache]: Creating missing document root /data/home/bug6005/public_html for bug6005
    [Cpanel::AdvConfig::apache]: Creating missing document root /data/home/wheredat/public_html for wheredat
    Built /usr/local/apache/conf/httpd.conf OK
    root@mundane [~/tmp]# grep -i scriptalias -c /usr/local/apache/conf/httpd.conf
    16
    root@mundane [~/tmp]# /scripts/rebuildhttpdconf 
    [Cpanel::AdvConfig::apache]: Creating missing document root /home/hometest/data/hmscenar/public_html for hmscenar
    [Cpanel::AdvConfig::apache]: Creating missing document root /home/wherecre/home/isthiswr/public_html for isthiswr
    [Cpanel::AdvConfig::apache]: Creating missing document root /data/home/bug6005/public_html for bug6005
    [Cpanel::AdvConfig::apache]: Creating missing document root /data/home/wheredat/public_html for wheredat
    Built /usr/local/apache/conf/httpd.conf OK
    root@mundane [~/tmp]# grep -i scriptalias -c /usr/local/apache/conf/httpd.conf
    768
    
    The first grep was with ScriptAlias enabled. The second was after disabling it in WHM Setup. The third was after re-enabling it in WHM Setup.

    ScriptAlias is not necessary for CGI capabilities; it simply instructs Apache to treat files in the specified directory as CGI programs.
     
    #8 cPanelKenneth, Aug 1, 2008
    Last edited: Aug 1, 2008
  9. kemis

    kemis Well-Known Member

    Joined:
    Feb 17, 2005
    Messages:
    104
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Georgetown, TX
    Worked like a charm!!! Thanks! For the record, here's all I had to do:

    1. Login to WHM & go to "Basic cPanel/WHM Setup" (first link).
    2. Change the "CGI Script Alias" setting from "n" to "y".
    3. Run "/scripts/rebuildhttpdconf".
    4. Run "service httpd restart".

    Bam! All my ScriptAliases suddenly appeared.

    Matt
     
Loading...

Share This Page