If you are developing in a Windows environment and need to host multiple sites on your Apache development workstation or server here are some tips for setting up your Apache configuration.
Download and install XAMPP
Verify apache is running after installation
<a href="http://localhost" target="_blank">http://localhost</a>
NOTE: If you are also running IIS you will need to disable socket pooling that is turned on by default and restart your workstation or server after making the changes. You won’t have to do this if you are using VS.NET built-in debug web server (cassini) for your .NET development. You will also need to use an alternate IP address for IIS as well as Apache and set * to the IP used for Apache in the VirtualHost block header below.
Windows Server 2000: http://articles.techrepublic.com.com/5100-10878_11-6067036.html
Windows Server 2003: http://www.sitebuddy.com/Apache/IIS/same/server
Open httpd-vhosts.conf
Make a backup of the default vhosts config; eg.
<install dir>\xampp\apache\conf\extra\httpd.conf.bak.
With your favorite text editor (Notepad++ is a great one) open
<install dir>\xampp\apache\conf\extra\httpd.conf
Copy the following.
# HTTP vhosts
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "<install dir>\htdocs\your-site.com"
ServerName your-site
ServerAlias your-site
</VirtualHost>
# HTTPS vhosts
NameVirtualHost *:443
<VirtualHost *:443>
DocumentRoot "<install dir>\htdocs\your-site.com"
ServerName your-site
ServerAlias your-site
SSLEngine on
SSLCertificateFile conf/ssl.crt/server.crt
SSLCertificateKeyFile conf/ssl.key/server.key
</VirtualHost>
Restart Apache
Open a command prompt, Windows + R or Windows + R + services.msc and restart Apache
C:\> net stop apache2 && net start apache2
Update hosts
Copy and make a backup of your hosts file.
%SystemRoot%\system32\drivers\etc\hosts.bak
Open your hosts file and add your new vhost site. The IP address should match the same IP address as your local workstation.
192.168.1.2 your-site
Check that you can ping your new hosts entry.
C:\> ping your-site
Moment of truth
If all went well you should be able to open your new vhost site.
http://your-site
Related Posts
Tags: Apache, iis and apache same server, ssl, vhosts, wamp





















