Warm tip: This article is reproduced from stackoverflow.com, please click
apache cpanel dns linux whm

WHM/cPanel

发布于 2020-04-08 15:43:22

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

Questioner
Rossitten
Viewed
67
Rossitten 2020-02-01 02:26

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 support@domain.net
    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]