Saturday, November 1, 2014

apache 2.4 - ServerAlias without www not working on SSL virtualhost

I'm moving a site from a server to another, and using its current and still valid SSL certificate. The machine I'm working on is a Ubuntu 14.04 server. I've set up my usual virtual host file, let's call it my_domain.conf. These are its contents:





#omitting the major/minor signs near VirtualHost
VirtualHost *:443
ServerAdmin webmaster@mydomain.com
ServerName mydomain.com
ServerAlias www.mydomain.com
SSLEngine on
SSLCertificateFile /etc/ssl/certs/mydomain.com.crt
SSLCertificateKeyFile /etc/ssl/private/mydomain.com.key
DocumentRoot /var/www/html/mydomain.com/public
ErrorLog /var/log/apache2/mydomain-error.log

TransferLog /var/log/apache2/mydomain-access.log
/VirtualHost


Now, when I type www.mydomain.com on a browser, the VirtualHost works. But when I type mydomain.com, it doesn't. Both the customer and the webdesigner need it, so I can't avoid it.
I tried




  • Swapping ServerName and ServerAlias, and using only ServerName

  • Disabling all the other virtualhosts, including default ones

  • Adding SSLStrictSNIVHostCheck both on and the off after noticing this line on my general (not site specific) error.log: [ssl:warn] [pid 6558] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)




Nothing changed, and I really can't figure out why this is happening



EDIT: I forgot to add, by "it doesn't work" I mean the virtual host config file is bypassed and the browser takes me to the apache2 default document root

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...