Apache and subdomains

MadsRC

n00b
Joined
Jul 26, 2012
Messages
4
I'm playing around with my Apache server and I'm trying to, in the best way, configure it like this: (There's 1 site on it right now)

I have a domain (say domain.tld) which have a documentroot of, say /var/www/domain/public_html

In the documentroot I have 2 folders called db and wiki, db contains phpmyadmin and wiki contains dokuwiki.

I want my site to respond to db.domain.tld and show phpmyadmin and wiki.domain.tld to show dokuwiki while domain.tld shows index of public_html.

I can do that easily with mupltiple virtualhosts, but I'd also like the site to work with SSL.

I've got a wildcard certificate set up for the site so domain.tld works over ssl, but I can't get it to work with the subdomains.

https://db.domain.tld won't work but http://db.domain.tld does work.

What is the best way to achieve this? Can I in one virtualhost define a ServerAlias with another documentroot?
 
I'd like to know this as well, I ended up just registering the subdomains with my DNS provider - but there are a limited number that I can get.
 
Check here: http://wiki.apache.org/httpd/NameBasedSSLVHosts

You should be able to declare a virtual host with SSL

Ours is setup just the example like:

NameVirtualHost 192.168.1.1:443

<VirtualHost 192.168.1.1:443>
SSLEngine on
SSLCertificateFile /etc/ssl/star.example.com.crt
SSLCertificateKeyFile /etc/ssl/star.example.com.key

ServerName "one.example.com"
DocumentRoot "/var/www/html/one"

<Directory /var/www/html>
</Directory>
</VirtualHost>
 
Back
Top