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.

Another way to change my external ip to internal in httpd.conf AUTOMATICALLY? Or fix?

Discussion in 'General Discussion' started by CrewXp, Apr 22, 2006.

  1. CrewXp

    CrewXp Active Member

    Joined:
    Nov 12, 2003
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    6
    My server is behind a NAT. To get addon domains and subdomains to work, I have to go into httpd.conf and change
    <VirtualHost 61.94.131.251> to <VirtualHost 192.168.18.251> for every new thing added.

    IS there any way to not do this when adding something? Anything I can change on cpanel to NOT DO THIS AT ALL or a cpanel script that does this for me each time a subdomain is added?

    thanks so much
     
  2. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,384
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Have a look at the template file that is located at:

    /usr/local/cpanel/etc/httptemplates/apache1/default

    I believe this template also presents itself when creating subdomains.

    This is also a chance for me to plug the Template enhancement that is in Bugzilla. This may affect you as well:

    http://bugzilla.cpanel.net/show_bug.cgi?id=3209
     
  3. bijo

    bijo Well-Known Member

    Joined:
    Aug 21, 2004
    Messages:
    475
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    Hello,

    I hope with the help of the replace command you can do it. Create a cron and run it.

    replace 61.94.131.251 192.168.18.251 -- /usr/local/apache/conf/httpd.conf
    But it will change all occurence of the ip 61.94.131.251
     
    #3 bijo, Apr 22, 2006
    Last edited: Apr 22, 2006
  4. CrewXp

    CrewXp Active Member

    Joined:
    Nov 12, 2003
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    6
    I read sparek's post and it seems the most useful in this situation (that way a cron won't be needed every so often)

    But I have a question.

    I posted a topic about it here:
    http://forums.cpanel.net/showthread.php?t=52157

    Or if you want the post text, here "I want to put a

    If %ip% = 69.62.234.12 Then %ip%=192.168.1.12
    If %ip% = 69.62.234.13 Then %ip%=192.168.1.13
    If %ip% = 69.62.234.14 Then %ip%=192.168.1.14
    If %ip% = 69.62.234.15 Then %ip%=192.168.1.15

    in the /usr/local/cpanel/etc/httptemplates/apache1/default

    file

    I know, that's not how to do it, but its just an example. Is there any way to put that in there? So I can call <VirtualHost %ip>, it will put that instead?

    Or use a replace command on %ip% to replace "69.62.234" with "192.168.1"???

    thanks!!"
     
  5. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    An alternative could be to use bijo's idea together with your last one and put the replace lines in /scripts/postwwwacct - the substitute will then be automatically done whenever you create a new account.
     
  6. brianoz

    brianoz Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    I have a standard .php template, installed from /home/reseller/cpanel3skel/public_html/index.php - that alters it's behaviour depending on who the reseller is. If the account reseller changes, the script behaviour changes.
     
  7. CrewXp

    CrewXp Active Member

    Joined:
    Nov 12, 2003
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    6
    aww!! I went through and typed the replace command in my wwwacct file for every ip I have, and I just read your msg. "It will take effect on new account creations". Well, if I'm just adding a subdomain, that's not creating a new account right, therefore won't do anything.
     
  8. intel352

    intel352 Well-Known Member

    Joined:
    Nov 25, 2003
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    NC, USA
Loading...

Share This Page