CPanel has two entries for site, need to use SSL one

Posted by beingalex on Server Fault See other posts from Server Fault or by beingalex
Published on 2012-10-23T16:54:14Z Indexed on 2012/10/23 17:04 UTC
Read the original article Hit count: 203

Filed under:
|
|
|

I have a website that is meant to be using SSL, however there are two entries in Cpanel's httpd.conf which seem to be causing an issue. When I visit just www.website.com I require it to go to https://www.website.com. However I have to write the https:// directly for the site to work. The secure site also has a different IP.

I am not meant to edit the httpd.conf directly either and am unsure as to how to change the following directives:

<VirtualHost 1.1.1.1:80>
    ServerName website.com
    ServerAlias www.website.com
    DocumentRoot /home/websitec/public_html
    ServerAdmin [email protected]
    ## User websitec # Needed for Cpanel::ApacheConf
    <IfModule mod_suphp.c>
        suPHP_UserGroup websitec websitec
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        <IfModule !mod_ruid2.c>
           SuexecUserGroup websitec websitec
        </IfModule>
    </IfModule>
    <IfModule mod_ruid2.c>
       RUidGid websitec websitec
    </IfModule>
    CustomLog /usr/local/apache/domlogs/website.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    CustomLog /usr/local/apache/domlogs/website.com combined
    ScriptAlias /cgi-bin/ /home/websitec/public_html/cgi-bin/
</VirtualHost>
<VirtualHost 2.2.2.2:443>
    ServerName website.com
    ServerAlias www.website.com
    DocumentRoot /home/websitec/public_html
    ServerAdmin [email protected]
    UseCanonicalName Off
    CustomLog /usr/local/apache/domlogs/website.com combined
    CustomLog /usr/local/apache/domlogs/website.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    ## User websitec # Needed for Cpanel::ApacheConf
    <IfModule mod_suphp.c>
        suPHP_UserGroup websitec websitec
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        <IfModule !mod_ruid2.c>
            SuexecUserGroup websitec websitec
        </IfModule>
    </IfModule>
    <IfModule mod_ruid2.c>
        RUidGid websitec websitec
    </IfModule>
    ScriptAlias /cgi-bin/ /home/websitec/public_html/cgi-bin/
    SSLEngine on

    SSLCertificateFile /etc/ssl/certs/www.website.com.crt
    SSLCertificateKeyFile /etc/ssl/private/www.website.com.key
        SSLCACertificateFile /etc/ssl/certs/www.website.com.cabundle
    CustomLog /usr/local/apache/domlogs/website.com-ssl_log combined
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
    <Directory "/home/websitec/public_html/cgi-bin">
        SSLOptions +StdEnvVars
    </Directory>

    # To customize this VirtualHost use an include file at the following location
    # Include "/usr/local/apache/conf/userdata/ssl/2/websitec/website.com/*.conf"

</VirtualHost>

As you can see there is obviously the unsecure directive before the secure one. And this is probably the issue, however if I try to change the IP for the site in WHM I get an error saying that the IP (2.2.2.2) is already in use. Which it is I guess.

Any help is appreciated.

© Server Fault or respective owner

Related posts about apache2

Related posts about ssl