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.

preserving httpd.conf changes?

Discussion in 'General Discussion' started by sirbrent, Jul 25, 2009.

  1. sirbrent

    sirbrent Well-Known Member

    Joined:
    Sep 30, 2008
    Messages:
    98
    Likes Received:
    1
    Trophy Points:
    8
    Hello,

    How can I permanently disable the forwarding of /webmail to cpanels webmail interface. I need to still keep webmail enabled but instead users will go to https://hostname:2096 instead. I need to disable this because I have a important (read: big account) client coming that uses their own webmail system and their employees access it at: theirdomain.com/webmail.... which by nature redirects to cpanels webmail system.

    I know that it is a ScriptAliasMatch in httpd.conf which is causing this. I have commented out that line, but the problem is that the config file rebuilds itself on updates, adding new vhosts and restarts. I need a more permanent solution.

    I have read about some script I can run which will cause cpanel to preserve changes during updates, new account creation and restarts (etc.) -- but I cannot seem to locate it now and am worried this approach would have negative side-effects... e.g. when it comes time to delete an account that is part of the 'preserved'/'reference' config. I also know about using the includes, however, correct me if i am wrong, i cannot negate existing rules (like a ScriptAliasMatch) only add new ones.

    Any information and possible solutions would be greatly appreciated.
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,482
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Have a close look at your proxy settings at WHM > Tweak Settings > Domains.
    And here if you're interested in doing this for just one domain instead, I think this would be helpful: InsideVHost < EasyApache3 < TWiki
     
  3. sirbrent

    sirbrent Well-Known Member

    Joined:
    Sep 30, 2008
    Messages:
    98
    Likes Received:
    1
    Trophy Points:
    8
    Thanks for the fast feedback.

    I have the option you are pointing to, in whm, enabled. But the tricky part is that they dont actually use a folder called webmail, the webmail application folder is actually theirdomain.com/rdmail but somewhere along the line they used an apache redirect of theirdomain.com/webmail to redirect to this.

    There website is huge and the codebase is very complex -- its been patched together hundreds of times. They want to keep the folder at /rdmail and still use an apache redirect to handle /webmail

    However, it seems that even with the option to enable accounts to have their own /webmail folder override the cpanel /webmail proxy... it isnt working properly in this case (still being handled by cp proxy)... probably has something to do with the fact that its a redirect? I tried just creating an empty folder called webmail and it didnt seem to help.

    I would try the other method you said about editing their apache configuration. I dont have the file structure it looks for in the documentation.
    in /usr/local/apache/conf there is no 'userdata' directory. So I could just create an include file like this: /usr/local/apache/conf/userdata/ssl/2/flotech/flotech.com/vhostdata.conf ??? Note: I did see a directory called "sites" that holds vhost data for some of my clients domain.

    Also, if I did want to just remove, or override, the /webmail ScriptAliasMatch rule for the entire server (and not have /webmail do anything -- treat it normally) from httpd.conf (main configuration), is there any place (a specfic include file?)/way to do this (where it will retain the changes)?

    Thanks for the reply.
     
    #3 sirbrent, Jul 25, 2009
    Last edited: Jul 25, 2009
  4. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,482
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    You'll have to go over those docs for exact answers. I think it explains at the top of the page I've linked you to:

    Have you checked the account itself for an htaccess file with a redirect that might be messing you up in what you want? If you're using the old cpanel proxy that was posted on the forums here long ago, part of that was an htaccess file in the account and creating subdomains, IIRC.

    How about disabling it? Does that help?
     
  5. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    1. Open /usr/local/cpanel/APACHE_CONFIG in your favorite editor

    2. Find the lines that reference /webmail

    3. Add the following to the beginning of each line that contains /webmail:

    Code:
    *REMOVE*
    
    ( Make certain there is a space after the final * )

    4. Save your changes and exit the editor

    5. Execute /scripts/check_cpanel_apache_aliases



    The above will remove the /webmail redirect for the entire server.
     
  6. sirbrent

    sirbrent Well-Known Member

    Joined:
    Sep 30, 2008
    Messages:
    98
    Likes Received:
    1
    Trophy Points:
    8
    This is exactly what I was looking for. Thank you very much.
     
Loading...

Share This Page