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

I have a subdomain that has an SSL certificate that is working nicely. The web address for it is, lets say, like this: sd1.mydomain.com (sd1=sub-domain 1). Now I want to add a second subdomain, but it doesn't need to have the certificate encrypting the data. Thus, I want: sd2.mydomain.com

I adjusted my sites-enabled directory to have two config files, one for each subdomain. The config file for the first, and working, subdomain looks like this (changing actual domain, to "mydomain", obviously):

<VirtualHost *:443>

    SSLEngine on
    SSLProtocol all
    SSLCertificateFile /usr/local/ssl/crt/certificate.crt
    SSLCertificateKeyFile /usr/local/ssl/crt/sd1.mydomain.com
    SSLCertificateChainFile /usr/local/ssl/crt/intermediate.crt
    ServerAdmin me@mydomain.com
    ServerName https://sd1.mydomain.com

    AliasMatch ^/([^/]*\.css) /srv/www/cpm/static_media/css/$1
    Alias /static_media/ /srv/www/cpm/static_media/
    Alias /static/admin/ /usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/
    Alias /favicon.ico "/srv/www/cpm/static_media/img/favicon.ico"


    <Directory /srv/www/cpm/static_media/>
        Options -Indexes
        Order deny,allow
        Allow from all
        deny from 219.0.0.0/8

    </Directory>

    WSGIScriptAlias / /srv/www/cpm/django.wsgi

    <Directory /srv/www/cpm>
        Options -Indexes
        Order deny,allow
        Allow from all
        deny from 219.0.0.0/8
    </Directory>

    ErrorLog /srv/www/logs/cpm_logs/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /srv/www/logs/cpm_logs/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

This site runs a Django webapp that needs to be secure, and it works nicely.

Now I want to set up a second website, a WIKI actually, that does NOT need to be secure, and so I created this config file for sd2.mydomain.com :

<VirtualHost *:80>

        ServerAdmin me@mydomain.com
        ServerName http://sd2.mydomain.com

        DocumentRoot /srv/www/wiki/public_html/

              <Directory />
                  Options FollowSymLinks
                  AllowOverride None
              </Directory>

              <Directory /srv/www/wiki/public_html/>
                  Options Indexes FollowSymLinks MultiViews
                  AllowOverride All
                  Order allow,deny
                  allow from all
              </Directory>


              ErrorLog /var/log/apache2/error.log

              # Possible values include: debug, info, notice, warn, error, crit,
              # alert, emerg.
              LogLevel warn

              CustomLog /var/log/apache2/access.log combined

              Alias /doc/ "/usr/share/doc/"
              <Directory "/usr/share/doc/">
                  Options Indexes MultiViews FollowSymLinks
                  AllowOverride None
                  Order deny,allow
                  Deny from all
                  Allow from 127.0.0.0/255.0.0.0 ::1/128
              </Directory>

</VirtualHost>

I don't have NameVirtualHost in there, because I am trying to get each site working on its own, before getting them both running at the same time. (I only activate one at a time)

My problem is that when I open a browser and try to go to http://sd2.mydomain.com the site simply will not load and there is nothing in the error log to tell me that something is going wrong. However, if I add all the same SSL stuff to my sd2.mydomain.com config file, the second site does work, but I have to navigate to https://sd2.mydomain.com for it to work, and, obviously, the SSL cert fails.

What am I doing wrong here? I feel like all the config stuff is accurate since there are no errors. What am I missing?

Thanks

share|improve this question

1 Answer 1

So what ports is Apache listening on when you run netstat -ntlp? I notice that don't seem to have a port 80 virtual host in your first example. Are you sure that you actually have Apache set with Listen 80? Or did that get changed so it is only Listen 443?

share|improve this answer
    
Oh, good point. I just added Listen 80 to my ports.conf file in the main /etc/apache2/ directory (then reloaded/restarted apache). However, same results - can't reach the sight, no error messages in the log file. –  Garfonzo Oct 18 '12 at 18:05

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.