Reputation: 183
I'm trying to create wildcard domains where
-I have the root server (landing page) on https://example.com
-And all subdomains (completely dynamic) on https://*.example.com
This is the wildcard virtualhost (listed BELOW the SSL include, which contains the root domain):
<VirtualHost *:443>
ServerName test.example.com
ServerAlias *.example.com:443
DocumentRoot /opt/lampp/htdocs/production/
SSLEngine on
SSLCertificateFile /etc/cert.pem
SSLCertificateKeyFile /etc/privkey.pem
SSLCertificateChainFile /etc/chain.pem
</VirtualHost>
This works fine for test.example.com, but when I try going on anything else, for instance 123.example.com it will default to the first virtualhost, defined in httpd-ssl, not this one.
So my question is, seeing that whichever ServerName I have set in the virtualhost, works, the rest do not, how can I have subdomains override the default virtualhost? Without ServerName it always defaults to the root (only ServerAlias).
I have tried placing this code BEFORE (inside the httpd-ssl) default host, but then it always used this for root.
Thanks!
Upvotes: 0
Views: 332
Reputation: 183
I have fixed it by placing this snippet above default and removing ServerName. The issue was that I had ServerName in the root www., but I'm not using www.
Upvotes: 0