you’re reading...

Programming

Setting Up XAMPP with SSL on Virtual Host in your Windows 7 Development Machine or Linux

Your Ad Here

XAMPP with SSL
XAMPP for Windows comes built in with SSL certificate for development use, the only thing that you need to do is to enable it to work with your Virtual Host to duplicate development setup in production environment. Setup of production and development machine is almost exactly the same except that the certificate for the production that you will need to use should be coming from a trusted SSL certification authority.

The default SSL on XAMPP only works by default in our localhost so it is accessible via https://localhost/any-directory-inside-htdocs.


To Make it work in Virtual Host Setup we need to do four things.

1. Configure httpd-vhosts.conf to work with standard virtual host http access at port 80.
-A detailed explanation on how to do step 1 is here: http://www.eg-designstudio.com/2009/01/14/configuring-apache-server-for-development-to-mimic-production-setup/

2. Configure httpd-ssl.conf to work with virtual host with https access or SSL enabled.

3. Modify hosts file of our Windows machine to point to virtual host mock address.

4. Restart apache server.

Things to note: In production setup SSL works by binding the SSL certificate on dedicated IP which is being done using network alias on Linux Machines. Short instruction on how to do that in Linux machine can be found here: Network Alias on CentOS

So with this in mind I’m going to bind the SSL certificate via my local IP connected to my wireless network which is : 192.168.1.34

Step 1. Configure httpd-vhost.conf to work with normal http access at port 80:
This can be found from DRIVE where you install xampp: /xampp/apache/conf/extra/httpd-vhost.conf

#################################################

ServerAdmin admin@eg-designstudio.com
DocumentRoot "D:/webprojects/whatever-your-folder-is"
ServerName www.mymocksite.com
ServerAlias mocksite.com


AllowOverride FileInfo AuthConfig Limit Indexes
#Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
#Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all

Order allow,deny
Allow from all
Order deny,allow
Deny from all


###############################################

Step 2. Configure httpd-ssl.conf to work with virtual host with https access or SSL enabled.
This can be found from DRIVE where you install xampp: /xampp/apache/conf/extra/httpd-ssl.conf, this file has a built in example configuration of SSL which is configured to work with localhost.

Just append the code here at the bottom of the file.

########################################################################

# General setup for the virtual host
DocumentRoot "D:/webprojects/whatever-your-folder-is"
ServerName www.mymocksite.com:443
ServerAlias mocksite.com:443


#AllowOverride FileInfo AuthConfig Limit Indexes
#Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all

Order allow,deny
Allow from all
Order deny,allow
Deny from all

ServerAdmin admin@eg-designstudio.com
ErrorLog logs/error.log

CustomLog logs/access.log combined

# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
# SSL Cipher Suite:
# List the ciphers that the client is permitted to negotiate.
# See the mod_ssl documentation for a complete list.
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile conf/ssl.crt/server.crt
SSLCertificateKeyFile conf/ssl.key/server.key

SSLOptions +StdEnvVars


BrowserMatch ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0


########################################################################

3. Modify hosts file of our Windows machine to point to virtual host mock address.
Your host file can be found at C:\windows\system32\drivers\etc\hosts

Modify your hosts file and append the code below to point to your local mock address

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
192.168.1.34 www.mymocksite.com
192.168.1.34 mymocksite.com

For Linux do the same as above or just do it once by adding the below code in your httpd.conf file
located at /etc/httpd/conf

#############################################

ServerAdmin admin@eg-designstudio.com
DocumentRoot /home/mocksite/public_html
ServerName www.mymocksite.com
ServerAlias mymocksite.com
ErrorLog logs/www.mocksite.com-error_log
CustomLog logs/www.mocksite.com-access_log combined


ServerName www.mymocksite.com:443
ServerAlias mocksite.com:443
DocumentRoot /home/mocksite/public_html
ErrorLog logs/www.mymocksite.com-error_log
CustomLog logs/www.mymocksite.com-access_log combined
LogLevel warn
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP
SSLCertificateFile /etc/httpd/conf/myssl/www.mymocksite.com.crt
SSLCertificateKeyFile /etc/httpd/conf/myssl/www.mocksite.com.private.key
SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.crt

SSLOptions +StdEnvVars

SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0

########################################

Step 4. Restart apache server and we are good to go. If you’ve done all the steps above then your SSL certificate should be properly configured by now and working.

Share

Discussion

No comments for “Setting Up XAMPP with SSL on Virtual Host in your Windows 7 Development Machine or Linux”

Post a comment

You must be logged in to post a comment.

Categories

Register/Login

Register and Participate

Registration to this website is free. Feel free to use and explore the features of the website. You are welcome to participate and interact with us in the forum. If you have concerns that you want us to know you can easily contact us using this link. By registering in this website, your account will allow you to login and participate in the forum and to access additional information that is only available to registered users. We are keeping this website to be informative for us and to our users.

Syndication

feeds


There was an Analytics API service error 403: Error calling GET https://www.googleapis.com/analytics/v3/management/accounts/468110/webproperties/UA-468110-5/profiles: (403) User does not have sufficient permissions for this account.Error - Account ID is blank
0
Unique
Visitors
Powered By Google Analytics