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.

Prevent vhost.default Overwrite?

Discussion in 'EasyApache' started by urantian, Nov 16, 2016.

  1. urantian

    urantian Well-Known Member

    Joined:
    Jan 26, 2005
    Messages:
    90
    Likes Received:
    1
    Trophy Points:
    158
    Location:
    Fayetteville, Arkansas
    cPanel Access Level:
    Root Administrator
    Greetings,

    My server provides a common cgi-bin directory structure, allowing multiple sites to run the same scripts. In the /var/cpanel/templates/apache2_4/vhost.default file, I modified the ScriptAlias template, to use a common ScriptAlias in the HTTPD.CONF file. I changed the "[% vhost.documentroot %]" portion below to the physical path I want to use:


    [% IF vhost.hascgi && scriptalias == 1 -%]
    ScriptAlias /cgi-bin/ [% vhost.documentroot %]/cgi-bin/
    [% END -%]

    This typically works fine in the event of automated updates, however the latest update apparently overwrote the vhost.default file, causing my sites to lose access to the common cgi-bin.

    Is there a way to either prevent the vhost.default from being over-written, or perhaps have an alternative for defining the ScriptAlias template?

    Thank you,

    Michael Reynolds
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,086
    Likes Received:
    1,288
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Could you verify if this system uses EasyApache 4, or EasyApache 3?

    Thank you.
     
  3. urantian

    urantian Well-Known Member

    Joined:
    Jan 26, 2005
    Messages:
    90
    Likes Received:
    1
    Trophy Points:
    158
    Location:
    Fayetteville, Arkansas
    cPanel Access Level:
    Root Administrator
    WHM indicates that EasyApache 4 is installed, according to the sub-menu title under Software. I also have this:

    Apache 2.4, PHP 5.6, and PHP 7.0

    Michael
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,086
    Likes Received:
    1,288
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  5. urantian

    urantian Well-Known Member

    Joined:
    Jan 26, 2005
    Messages:
    90
    Likes Received:
    1
    Trophy Points:
    158
    Location:
    Fayetteville, Arkansas
    cPanel Access Level:
    Root Administrator
    Thank you. I created the vhost.local file with the customized ScriptAlias template, and returned vhost.default to its original state. After running /scripts/rebuildhttpdconf, httpd.conf shows the proper values, and sites work as expected.

    Which file should be used for storing the customized ScriptAlias template? vhost.local? Should vhost.default be left alone, because it might be over-written?

    Michael
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,086
    Likes Received:
    1,288
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Yes, vhost.default should be left alone and modifications to this file should always occur in the vhost.local file instead.

    Thanks.
     
  7. urantian

    urantian Well-Known Member

    Joined:
    Jan 26, 2005
    Messages:
    90
    Likes Received:
    1
    Trophy Points:
    158
    Location:
    Fayetteville, Arkansas
    cPanel Access Level:
    Root Administrator
    Great! Thank you for the clarification, and for your assistance.

    Michael
     
  8. urantian

    urantian Well-Known Member

    Joined:
    Jan 26, 2005
    Messages:
    90
    Likes Received:
    1
    Trophy Points:
    158
    Location:
    Fayetteville, Arkansas
    cPanel Access Level:
    Root Administrator
    I have one additional question.

    In the vhost.local file, does the file need to contain the entire template from vhost.default, or can it contain only those portions that are being customized?

    Michael
     
  9. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,086
    Likes Received:
    1,288
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    You should start by copying the vhost.default file first, and then making adjustments to it accordingly.

    Thank you.
     
Loading...

Share This Page