skip to Main Content

we need our new dedicated IP address (and all future ones) to “point” to the same root directory of our VPS’ “parent” domain (main domain with all business logic, where $_SERVER[‘host’] is detected to connect associated files etc. )

So, for example, domain.net (x.x.x.146) should show content of domain.com (x.x.x.170) etc

We have list of dedicated IPs, added to WHM. We have number of domain names, with those IPS as DNS A records. We have added those domains via cPanel to point to the same public_html..

enter image description here
But all the domains resolve to : cgi-sys/defaultwebpage.cgi with “SORRY! If you are the owner of this website, please contact your hosting provider:” error.

Any suggestions? This is supposed to be quite an easy task, but clearly – not so.

Thank you

2

Answers


  1. Chosen as BEST ANSWER

    here is the solution. It is not ideal bot it looks like there's not much we can do, having cPanel/WHM installed.

    <VirtualHost x.x.x.x:443>
        ServerName domain.net
        ServerAlias www.domain.net
        DocumentRoot /home/user/public_html
        #todo common contact mail
        ServerAdmin [email protected]
        UseCanonicalName Off
        <IfModule mod_suphp.c>
            suPHP_UserGroup user user
        </IfModule>
        <IfModule ssl_module>
            SSLEngine on
            SSLCertificateFile /etc/letsencrypt/live/domain.net/cert.pem
            SSLCertificateKeyFile /etc/letsencrypt/live/domain.net/privkey.pem
            SSLCertificateChainFile /etc/letsencrypt/live/domain.net/chain.pem
            SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
        </IfModule>
        <IfModule headers_module>
            RequestHeader set X-HTTPS 1
        </IfModule>
    </VirtualHost>
    
    • redirect from 80 to 443 set separately:
        
        RewriteEngine On 
        RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
        
    

  2. Why do you need many IP address? one IP address should be enough for what you want to do.
    Indeed HTTP/1.1 protocol is meant for this purpose: many different domains for one IP.
    In your VPS you can use for example “Apache” as a Web server with this basic configuration:

    ceate/edit on “/etc/apache2/sites-available/” example.com.conf :

    <VirtualHost *:80>
    
    DocumentRoot /home/user/pulic_html
    ServerName example.com
    
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    
    </VirtualHost>
    

    then create/edit example.org.conf:

    <VirtualHost *:80>
    
    ServerName example.org
    Redirect permanent / http://example.com/
    
    </VirtualHost>
    

    and so on..

    then to enable your configuration :

    a2ensite example.com.conf example.org.conf
    sudo service apache2 restart
    

    If you still want to use many IPs you can install apache in every machine hosting the IP, then redirect to your main site/domain(http://example.com), as shown above. Otherwise, if your hosting provider allow, you can redirect your children domain to your parent domain from your provider website with GUI.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search