I have a couple websites I'm developing and through virtual servers and different document roots, have them configured to be accessed based on port. I.e. localhost:8010
for one site, localhost:8020
for another.
Before I had multiple sites, SSL worked fine with just one using ports 80 and 443. However now the unescured sites load fine but for either one the SSL connection cannot be established. It also seems like its not changing the port--when I click on a link that starts with https:// it tries to go to https://localhost:8010/secure/route
.
I'm fine with either urls like https://localhost:8010/secure/route
to work, or for it depending on the site to auto-escalate to some other port (i.e. https://localhost:8011/project/one/secure/route
, https://localhost:8021/project/two/secure/route
), or something else as long as I can run two sites locally using different ports and SSL!
In my httpd.conf I have:
Listen 8010
Listen 8020
as well as:
<Directory "/path/to/project/one">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
<Directory "/path/to/project/two">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
In my httpd-vhosts.conf I have:
<VirtualHost *:8010>
ServerAdmin zugwalt@projectone.com
DocumentRoot "/path/to/project/one"
ServerName localhost:8010
ErrorLog "logs/projectone-error.log"
CustomLog "logs/projectone-access.log" common
</VirtualHost>
<VirtualHost *:8020>
ServerAdmin zugwalt@projecttwo.com
DocumentRoot "/path/to/project/two"
ServerName localhost:8020
ErrorLog "logs/projecttwo-error.log"
CustomLog "logs/projecttwo-access.log" common
</VirtualHost>
And in my httpd-ssl.conf I have:
Listen 443
<VirtualHost *:443>
DocumentRoot "/path/to/project/one"
ServerName localhost:8010
SSLEngine on
SSLCertificateFile /path/to/ssl/server.crt
SSLCertificateKeyFile /path/to/ssl/server.key
</VirtualHost>
<VirtualHost *:443>
DocumentRoot "/path/to/project/two"
ServerName localhost:8020
SSLEngine on
SSLCertificateFile /path/to/ssl/server.crt
SSLCertificateKeyFile /path/to/ssl/server.key
</VirtualHost>
I'm using Apache 2.4 on Windows 7