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.

Server Name Location?????

Discussion in 'General Discussion' started by jackal, Mar 8, 2003.

  1. jackal

    jackal Well-Known Member
    PartnerNOC

    Joined:
    Feb 23, 2002
    Messages:
    708
    Likes Received:
    0
    Trophy Points:
    16
    I have purchased a server that once had a different name.
    Now I have changed name in the whm panel. and on all new account pages it shows new server name, but when I try this script it still shows old name. Where would I find the server name outside of the whm panel to change it? Where is it Hiding?

    PHP:
    <p>Welcome to future home of <!--#echo var="SERVER_NAME" --></p>

    :confused: :confused:
     
  2. Robert_

    Robert_ Well-Known Member

    Joined:
    Apr 26, 2002
    Messages:
    89
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Arizona
    pico /etc/hosts

    make sure it is showing the hostname you want if not change for example the srv1a's to your hostname


    # Do not remove the following line, or various programs
    # that require network functionality will fail.

    00.000.000.00 srv1a.domain.com srv1a
    127.0.0.1 localhost

    ctrl x


    pico /etc/sysconfig/network

    check that matches

    NETWORKING=yes
    HOSTNAME=srv1a.domain.com
    GATEWAY=00.000.000.00


    ctrl x



    Reboot and everything should work

    Keyword should!
     
  3. jackal

    jackal Well-Known Member
    PartnerNOC

    Joined:
    Feb 23, 2002
    Messages:
    708
    Likes Received:
    0
    Trophy Points:
    16
    Thanks Robert that worked

    using this on our skelton diretory

    PHP:
    <p>Welcome to future home of <!--#echo var="SERVER_NAME" --></p>
    It returns this like it should

    Welcome to future home of server.name.net

    Any idea how we would change that script where it would show something like

    Welcome to future home of New Domain

    New Domain being the name of the site when a new user signs up?

    Like I said thanks again
     
  4. Robert_

    Robert_ Well-Known Member

    Joined:
    Apr 26, 2002
    Messages:
    89
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Arizona
    Im still setting up myself so this was a useful question. :)


    You can do it with php




    <p>
    Welcome to the future home of
    PHP:
    <?php echo "http://$SERVER_NAME"?>
    </p>
     
  5. Juanra

    Juanra Well-Known Member

    Joined:
    Sep 22, 2001
    Messages:
    777
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Spain
    Ok, that SERVER_NAME variable is just the Apache SERVER_NAME env variable, which is given by the ServerName directive of httpd.conf. If you go to:

    www.example.com

    it will show "Welcome to future home of www.example.com" but if you go to:

    host.name.com/~example/

    then it will show "Welcome to the future home of host.name.com"

    With SSI you can try this (in the first line put your own hostname as given by the ServerName directive in httpd.conf).

    <h1>Under Construction</h1>
    <!--#if expr="\"$SERVER_NAME\" != \"host.name.com\"" -->
    <h2><!--#echo var="SERVER_NAME" --></h2>
    <!--#endif -->

    It is not be as bad as the simpler solution but I'm pretty sure some customers would get confused.
     
  6. jackal

    jackal Well-Known Member
    PartnerNOC

    Joined:
    Feb 23, 2002
    Messages:
    708
    Likes Received:
    0
    Trophy Points:
    16
    Ok that shows under construction if possible want to show Welcome to the future home of domain.net

    Your code gives this
    http://64.71.165.249/~rad345c/
     
  7. Robert_

    Robert_ Well-Known Member

    Joined:
    Apr 26, 2002
    Messages:
    89
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Arizona
    For that code to work the domain needs to be resolved to your nameservers.

    hmm I dont think the code did that jackal I think that is the page you already have in your skel dir.


    Im going to see what I can come up with I would also like it when the email goes out for the client to goto http://00.000.000.00/~username and get a some $domain coming soon.
     
  8. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    The only way we found to do this was to modify wwwacct and have it create a special file for us that we call.

    I take it you want something like this?

    http://www.dgbaker.net/

    <?php

    $FILEPATH = "../OUR SPECIAL FILE";
    $FILE = fopen($FILEPATH, "r");
    $a = fgets($FILE, 300); = DOMAIN NAME
    $b = fgets($FILE, 300); = HOME SERVER
    $c = fgets($FILE, 300); = USERNAME
    fclose($FILE);

    echo"<html><head>";
    echo"<title>Welcome to the future home of $a</title>";
    echo"</head><body style=\"font-family: Arial; font-size: 10pt; >";


    ETC......
     
  9. Robert_

    Robert_ Well-Known Member

    Joined:
    Apr 26, 2002
    Messages:
    89
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Arizona
    :cool: cool!


    Thanks
     
  10. jackal

    jackal Well-Known Member
    PartnerNOC

    Joined:
    Feb 23, 2002
    Messages:
    708
    Likes Received:
    0
    Trophy Points:
    16
    What would you put that in yur sketlon dir then everytime someone signs up it would add their domain to their index page. How ould this work with the temp ip like I have above.
     
  11. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    Our's works this way,

    When a new account is being created we have an extra file created and added to there /home/user area.

    In this file is their domain name and such. Then our default index.php file reads in that file to grab the info to build the index page.

    So even if the user goes to http://Ip Address/~username, the index page is reading in the correct file and getting the domain name from the file. The index page is generated everytime it is needed.

    Now we've done ours in the wwwacct file, but it should really be done in the postacct file /scripts.
     
  12. Robert_

    Robert_ Well-Known Member

    Joined:
    Apr 26, 2002
    Messages:
    89
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Arizona
    Im trying to figure out how to modify the wwwacct


    <-- not really a scripter ~ but its fun

    so far this is what I got

    open (indexdom, ">/usr/indexdomains.txt") or
    die ("Cannot open indexdomains.txt");
    print indexdom "$some variable";
    close (indexdom);


    that should print it to the file

    I think still working on it
     
  13. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    Close.

    open(CPDATA,">$uhomedir/FILENAME");
    print CPDATA "$domain\n";
    print CPDATA "MAIN HOST SERVER\n";
    print CPDATA "$user\n";
    close(CPDATA);
    chmod 0644, "$uhomedir/FILENAME";
     
  14. jackal

    jackal Well-Known Member
    PartnerNOC

    Joined:
    Feb 23, 2002
    Messages:
    708
    Likes Received:
    0
    Trophy Points:
    16
    tried to keep up, finally lost me though

    :) :( :confused: :)
     
  15. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    Okay I try to explain.

    In /scripts/wwwacct we edited it and added this;

    open(CPDATA,">$uhomedir/FILENAME");
    print CPDATA "$domain\n";
    print CPDATA "MAIN HOST SERVER\n";
    print CPDATA "$user\n";
    close(CPDATA);
    chmod 0644, "$uhomedir/FILENAME";


    Now in our skel_dir is the index.php file that is looking for variables. When the users home directory is created, the index.php is put there as well as our new file.

    The index.php file reads the new file and assigns a each value in the file to a variable. Then the index.php uses those variable to build the page.
     
  16. Robert_

    Robert_ Well-Known Member

    Joined:
    Apr 26, 2002
    Messages:
    89
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Arizona
    Yay it works! :D


    Thankyou Dgbaker




    Here is sort of a step by step


    append to /scripts/wwwacct


    I have it stick the info in the users public_html dir
    modify the server name field to your domain or whatever.

    open(CPDATA,">$uhomedir/public_html/tmpinfo.txt");
    print CPDATA "$domain\n";
    print CPDATA "http://www.Iconoshosting.com\n";
    print CPDATA "$user\n";
    close(CPDATA);
    chmod 0644, "$uhomedir/public_html/tmpinfo.txt";

    I placed the code around line 1258

    save/upload and thats done.




    Now to make your index.php for your skel dir

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <?php

    $FILEPATH = "../public_html/tmpinfo.txt";
    $FILE = fopen($FILEPATH, "r");
    $a = fgets($FILE, 300);
    $b = fgets($FILE, 300);
    $c = fgets($FILE, 300);
    fclose($FILE);

    echo"
    <html>
    <head>
    <title>Welcome to the future home of www.$a</title>
    </head>
    <body>
    <br /><br />
    <br /><br />
    <br /><br />
    <center>Welcome to the future home of www.$a
    <br /><br />
    Hosted by <a href=\"http://www.iconoshosting.com\">$b</a>
    <br /><br /><br />
    <a href=\"http://www.iconoshosting.com/cc\">Client Login</a>
    <br /><br />
    <a href=\"http://63.244.130.53/cpanel\">Site Control Panel</a>

    </center>
    </body>
    </html>
    ";
    ?>

    save/upload

    Done! :)


    Example: http://63.224.130.53/~makenet/


    Thanks dgbaker
     
  17. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    No problem, but note: wwwacct is overwritten everynight. Either get postacct working or chattr +i wwwacct and manually update every once and while.
     
  18. Juanra

    Juanra Well-Known Member

    Joined:
    Sep 22, 2001
    Messages:
    777
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Spain
    See here:

    http://html.conclase.net/cp/scripts/defindex.txt

    You define your index file in your skeleton directory with a %domain% placeholder for the domain name and the script will do the rest. For example:

    <title>%domain%</title>
    <body style="text-align:center">
    <h1>Welcome to the future home of<br>%domain%</h1>
    </body>

    This is beta and runs as root, so use at your own risk.
     
  19. jackal

    jackal Well-Known Member
    PartnerNOC

    Joined:
    Feb 23, 2002
    Messages:
    708
    Likes Received:
    0
    Trophy Points:
    16
    Thanks guys we have it working now,
    Robert one question.

    The cpanel login we placed our shared ip in the file and it works with all new accounts on the shared ip.
    We also have plans that get a dedicated ip with their accounts,
    Anyway to place something there that picks up whatever ip is assigned on account when the signup takes place. Could be shared ip or could be a dedicated ip.

    http://64.71.165.249/~wolfman/
    that is our shared ip.
     
  20. Robert_

    Robert_ Well-Known Member

    Joined:
    Apr 26, 2002
    Messages:
    89
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Arizona
    It might be possible but it would require closer examination of wwwacct. Might be as simple as modifying some variables in dg's script.

    So far wwwacct hasnt changed but I dont have whm set to auto update.

    When I get some time to tinker with wwwacct I will try to see if I can get it to do that. If I get it working I will post.
     
Loading...

Share This Page