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.

Is it possible to Open Website with VPS main IP (http://XX.XX.XX.XX)

Discussion in 'General Discussion' started by lldeepakll, Jul 12, 2012.

  1. lldeepakll

    lldeepakll Well-Known Member

    Joined:
    May 20, 2012
    Messages:
    86
    Likes Received:
    2
    Trophy Points:
    8
    Location:
    India
    cPanel Access Level:
    Root Administrator
  2. NixTree

    NixTree Well-Known Member

    Joined:
    Aug 19, 2010
    Messages:
    386
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Gods Own Country
    cPanel Access Level:
    Root Administrator
    Hello,

    Don't you have an additional IP for your server, if so set the additional IP as the main shared IP from cPanel and the set IP using which you want to access dedicated to the particular account. If you won't add more account, it is safe to set even a "private" IP as the main shared IP; it won't harm AFAIK.

    Thank you.
     
  3. lldeepakll

    lldeepakll Well-Known Member

    Joined:
    May 20, 2012
    Messages:
    86
    Likes Received:
    2
    Trophy Points:
    8
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Thanks for your reply. Further I don't want to purchase additional IP, And please let me know the steps how can I open the website with vps main IP. Do I need to change DocumentRoot to /home/username/public_html/ in httpd.conf file ? and if I change the DocumentRoot then if I make new accounts on this vps then will it effect to those accounts or not ? I mean new accounts will work or not ?
     
  4. NixTree

    NixTree Well-Known Member

    Joined:
    Aug 19, 2010
    Messages:
    386
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Gods Own Country
    cPanel Access Level:
    Root Administrator
    Ok..login as root via SSH

    >> open httpd.conf

    >> Now copy down the virtualhost entry for your domain

    >> open /usr/local/apache/conf/includes/pre_virtualhost_2.conf and enter the virtualhost entry you have copied to this file

    >> restart apache

    >> access http://ip
     
  5. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    There's a lot easier way to do it. You should just revise /usr/local/apache/htdocs/index.html file to change it from going to the default page:

    Code:
    <html><head><META HTTP-EQUIV="refresh" CONTENT="0;URL=/cgi-sys/defaultwebpage.cgi"></head><body></body></html>
    Change to the following:

    Code:
    <html><head><META HTTP-EQUIV="refresh" CONTENT="0;URL=http://domain.com"></head><body></body></html>
    Please replace domain.com with your domain name. The index.html entry isn't overwritten on EasyApache updates and because the main shared IP is the default entry at the beginning of /usr/local/apache/conf/httpd.conf VirtualHost section, it always goes to whatever is in index.html in /usr/local/apache/htdocs folder.

    Here's that first VirtualHost entry:

    Code:
    <VirtualHost 208.74.124.109:80>
        ServerName server.domain.com
        DocumentRoot /usr/local/apache/htdocs
        ServerAdmin user@email.com
        <IfModule mod_suphp.c>
            suPHP_UserGroup nobody nobody
        </IfModule>
    </VirtualHost>
    Of course, server.domain.com is the server's hostname and user@email.com is your email set in WHM > Basic cPanel & WHM Setup area. Again, this is the very first VirtualHost entry for the main shared IP, so it's what all sites will go to when hitting the IP. Setting index.html in the htdocs folder ensures it goes to whatever site you prefer instead. No need to get a dedicated IP or create another VirtualHost entry to override it.
     
  6. lldeepakll

    lldeepakll Well-Known Member

    Joined:
    May 20, 2012
    Messages:
    86
    Likes Received:
    2
    Trophy Points:
    8
    Location:
    India
    cPanel Access Level:
    Root Administrator
    That's Great Tristan. Thank you very much to both of You (Tristan & techs4gnu).
     
Loading...

Share This Page