Before I begin to explain my issue, it's worth noting that my DNS records are setup correctly.
This is a weird error, I have a server with the ip: 82.4.165.27
hosting several virtual directories. I'm using Apache2.
My http://test.chorkley.co.uk/
url is usually setup to forward to https://test.chorkley.co.uk
. That works. At the moment it simply loads the expected webpage.
So the http://test.chorkley.co.uk/
url works as expected, however the https://test.chorkley.co.uk/
does not. It incorrectly loads https://home.chorkley.co.uk/
.
For some reason, the apache server doesn't recognise the *:443
version of the https://test.chorkley.co.uk/
site.
apache2ctl -S
Output:
[Sat Apr 11 03:31:29.843972 2015] [core:error] [pid 11925] (EAI 2)Name or service not known: AH00547: Could not resolve host name *443 -- ignoring!
VirtualHost configuration:
*:443 is a NameVirtualHost
default server home.chorkley.co.uk (/etc/apache2/sites-enabled/default.conf:6)
port 443 namevhost home.chorkley.co.uk (/etc/apache2/sites-enabled/default.conf:6)
port 443 namevhost cloud.chorkley.co.uk (/etc/apache2/sites-enabled/default.conf:20)
*:80 is a NameVirtualHost
default server home.chorkley.co.uk (/etc/apache2/sites-enabled/default.conf:1)
port 80 namevhost home.chorkley.co.uk (/etc/apache2/sites-enabled/default.conf:1)
port 80 namevhost cloud.chorkley.co.uk (/etc/apache2/sites-enabled/default.conf:15)
port 80 namevhost test.chorkley.co.uk (/etc/apache2/sites-enabled/default.conf:29)
port 80 namevhost vb.chorkley.co.uk (/etc/apache2/sites-enabled/default.conf:44)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="steven" id=1000 not_used
Group: name="www-data" id=33 not_used
My file:
<VirtualHost *:80>
ServerName home.chorkley.co.uk
ServerAdmin admin@chorkley.co.uk
Redirect permanent / https://home.chorkley.co.uk/
</VirtualHost>
<VirtualHost *:443>
ServerName home.chorkley.co.uk
ServerAdmin admin@chorkley.co.uk
DocumentRoot /var/www/home.chorkley.co.uk
SSLCertificateFile /home/steven/.ssl/home.chorkley.co.uk.crt
SSLCertificateKeyFile /home/steven/.ssl/home.chorkley.co.uk.key
SSLCertificateChainFile /home/steven/.ssl/sub.class1.server.ca.pem
</VirtualHost>
<VirtualHost *:80>
ServerName test.chorkley.co.uk
ServerAdmin admin@chorkley.co.uk
DocumentRoot /var/www/test.chorkley.co.uk
#Redirect permanent / https://test.chorkley.co.uk/
</VirtualHost>
<VirtualHost *443>
ServerName test.chorkley.co.uk
ServerAdmin admin@chorkley.co.uk
DocumentRoot /var/www/test.chorkley.co.uk
SSLCertificateFile /home/steven/.ssl/test.chorkley.co.uk.crt
SSLCertificateKeyFile /home/steven/.ssl/test.chorkley.co.uk.key
SSLCertificateChainFile /home/steven/.ssl/sub.class1.server.ca.pem
</VirtualHost>
Best Answer
You need to change
to:
in the vhost for test.chorkley.co.uk
(notice the missing colon in your config)