Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Prevent vhost.default Overwrite?

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

  1. urantian

    urantian Well-Known Member

    Joined:
    Jan 26, 2005
    Messages:
    95
    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:
    44,396
    Likes Received:
    1,857
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

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

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. urantian

    urantian Well-Known Member

    Joined:
    Jan 26, 2005
    Messages:
    95
    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:
    44,396
    Likes Received:
    1,857
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. urantian

    urantian Well-Known Member

    Joined:
    Jan 26, 2005
    Messages:
    95
    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:
    44,396
    Likes Received:
    1,857
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. urantian

    urantian Well-Known Member

    Joined:
    Jan 26, 2005
    Messages:
    95
    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:
    95
    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:
    44,396
    Likes Received:
    1,857
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice