Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I just set up a VPS using WHM. I setup the account, and installed an SSL certificate. Everything serves fine using an HTTPS connection, but any time I try to load anything via vanilla HTTP, I just get a 404 error.

I've looked at the generated VirtualHost settings, and both port 80 and 443 share the same document root. This is only happening on the subdomain (secure.example.com) that the SSL cert is configured for. Serving HTTP over the regular domain (example.com) works fine.

What am I missing? Thanks.

UPDATE:

Here's my vhost config.

example.com

<VirtualHost server.ip.address:80>
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /home/username/public_html
    ServerAdmin webmaster@example.com
    UseCanonicalName Off
    CustomLog /usr/local/apache/domlogs/example.com combined
    CustomLog /usr/local/apache/domlogs/example.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    ## User username # Needed for Cpanel::ApacheConf
    UserDir disabled
    UserDir enabled username 
    <IfModule mod_suphp.c>
        suPHP_UserGroup username username
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        SuexecUserGroup username username
    </IfModule>
    ScriptAlias /cgi-bin/ /home/username/public_html/cgi-bin/


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

</VirtualHost>

secure.example.com

<VirtualHost server.ip.address:80>
    ServerName secure.example.com
    ServerAlias www.secure.example.com
    DocumentRoot /home/username/public_html/secure
    ServerAdmin webmaster@secure.example.com
    UseCanonicalName Off
    CustomLog /usr/local/apache/domlogs/secure.example.com combined
    CustomLog /usr/local/apache/domlogs/secure.example.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    ## User username # Needed for Cpanel::ApacheConf
    UserDir disabled
    UserDir enabled username
    <IfModule mod_suphp.c>
        suPHP_UserGroup username username
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        SuexecUserGroup username username
    </IfModule>
    ScriptAlias /cgi-bin/ /home/username/public_html/secure/cgi-bin/


    # To customize this VirtualHost use an include file at the following location
    # Include   "/usr/local/apache/conf/userdata/std/2/username/secure.example.com/*.conf"

</VirtualHost>

secure.example.com:443

<VirtualHost server.ip.address:443>
    ServerName secure.example.com
    ServerAlias www.secure.example.com
    DocumentRoot /home/username/public_html/secure
    ServerAdmin webmaster@secure.example.com
    UseCanonicalName Off
    CustomLog /usr/local/apache/domlogs/secure.example.com combined
    CustomLog /usr/local/apache/domlogs/secure.example.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    ## User username # Needed for Cpanel::ApacheConf
    UserDir disabled
    UserDir enabled username
    <IfModule mod_suphp.c>
        suPHP_UserGroup username username
    </IfModule>
    <IfModule !mod_disable_suexec.c>
         SuexecUserGroup username username
    </IfModule>
    ScriptAlias /cgi-bin/ /home/username/public_html/secure/cgi-bin/
    SSLEngine on

    SSLCertificateFile /etc/ssl/certs/secure.example.com.crt
    SSLCertificateKeyFile /etc/ssl/private/secure.example.com.key
    CustomLog /usr/local/apache/domlogs/secure.example.com-ssl_log combined
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
    <Directory "/home/username/public_html/secure/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/username/secure.example.com/*.conf"

 </VirtualHost>
share|improve this question
    
add VirtualHost configuration –  alvosu Feb 7 '11 at 16:21

1 Answer 1

up vote 0 down vote accepted

Are you sure these vhost configurations are being loaded? (That is, are they being included by apache2.conf)? If the secure.example.com configuration isn't being loaded, requests on port 80 for secure.example.com might get served by example.com and therefore get 404s because the file URIs would be wrong. (To check this concept, try adding secure/ to the request URLs and see if they work.)

share|improve this answer
    
You get credit because the situation you described was totally accurate. Although, the real solution the problem was that I forgot to remove some entries in my /etc/hosts file while I was troubleshooting earlier. –  Bryan M. Feb 7 '11 at 18:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.