I am writing a php app on my local machine and would like to test to see if SSL is working. Bear with me because this is the first time I've ever used SSL.
So far this is what I've done:
server.crt
file into chrome.;extension=php_openssl.dll
in php.ini
(reference)httpd-vhosts.conf
file based on this page. The relevant section of that file is below. This is the full file: http://pastebin.com/k6Jh2eR6
<VirtualHost *> DocumentRoot "C:\Users\user_name\Documents\project_one" ServerName project_one.localhost SSLEngine on SSLCertificateFile "conf/ssl.crt/server.crt" SSLCertificateKeyFile "conf/ssl.key/server.key" <Directory "C:\Users\user_name\Documents\project_one"> AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
I would usually access my project by typing in http://project_one.localhost
When trying to access my project by typing https://project_one.localhost
into chrome I automatically get forwarded to https://project_one.localhost/xampp/
(as if XAMPP doesn't recognize https://project_one.localhost
as a subdomain at all and treats it as if I'm typing in https://localhost
) Any idea where I'm screwing up?
NOTE:
LoadModule ssl_module modules/mod_ssl.so
was uncommented in httpd.conf
fileSSL, of the HTTPS://url.here/
variety, is entirely handled by Apache and has nothing to do with PHP, or any of PHP's extensions/modules, or any php.ini settings.
A typical SSL Enabled VirtualHost looks like this and contains at least these parts...
<VirtualHost *:443>
DocumentRoot "C:/WampDeveloper/Websites/www.example.com/webroot"
ServerName www.example.com
ServerAlias example.com
SSLEngine On
SSLCertificateFile "C:/WampDeveloper/Websites/www.example.com/certs/public.crt"
SSLCertificateKeyFile "C:/WampDeveloper/Websites/www.example.com/certs/private.key"
<Directory "C:/WampDeveloper/Websites/www.example.com/webroot">
Options All
AllowOverride All
order allow,deny
allow from all
</Directory>
</VirtualHost>
(The paths above are from my WampDeveloper Pro set up, Xampp's will be slightly different)
Your <VirtualHost *>
line is faulty. It needs a port number, which is always 443 for an HTTPS:// URL, in combination with either an IP address or a star before it. And if using a star, also a NameVirtualHost *:443
line...
NameVirtualHost *:80
NameVirtualHost *:443
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:443>
DocumentRoot "C:\Users\user_name\Documents\project_one"
ServerName project_one.localhost
SSLEngine on
SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"
<Directory "C:\Users\user_name\Documents\project_one">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\Users\user_name\Documents\project_two"
ServerName project_two.localhost
<Directory "C:\Users\user_name\Documents\project_two">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>