Website Tips


Monday, 07 October 2013 18:24

Developing web sites on a Windows PC

Written by 
Rate this item
(0 votes)

Developing web sites on a Windows PC

Using IIS is fine if you are going to work on a dot net website.
Since I don't bother with dot net or ASP I use Apache to develop websites on my PC.
Also Windows does not allow you to have more than one website on your PC.
You can place several in sub folders but you can set them to have their own public root.
Also Windows does not support the use of .htaccess
So if you are building sites for Linux servers and don't want to setup a Linux box this is the solution.

First we need to install the Apache Web Server.
You can get it at http://httpd.apache.org/download.cgi#apache24
Go to the link for Apache version 2.2.25 and choose which one you need.
One has SSL support and the other does not.
Since this is a development server then the question is do you really need a SSL service?
If you think you maybe be writing code for a shopping cart which would require
 testing the Merchant code then by all means choose the SSL version.
I went with the non SSL version as I will not be building applications.

If you have IIS installed remove it!
Install Apache and make the minor adjustments for it to work as you wish.
This includes setting the DocumentRoot to where you want your web sites to reside.
Can be DocumentRoot "C:/wwwroot/" for instance.
Now lets setup Apache so you can have multiple sites on your PC.
Look for the lines:
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

Remove the pound sign for this include.
Open the httpd-vhosts.conf in notepad and copy one of the <VirtualHost *:80> entries
Lets assume you have a site you wish to name site1.
Paste it as a new entry and edit it to your website name which will look like:
<VirtualHost *:80>
    ServerAdmin This email address is being protected from spambots. You need JavaScript enabled to view it.
    DocumentRoot "C:/wwwroot/site1"
    ServerName site1.loc
    ServerAlias www.site1.loc
    ErrorLog "logs/site1.localhost-error.log"
    CustomLog "logs/site1.localhost-access.log" common

</VirtualHost>

You can create one for each website you wish to work on.
The last step is you also need to enter a line in your hosts file for each web site added.

127.0.0.1 site1.loc

You now need to restart Apache.
Now you can enter http://site1.loc or http://www.site1.loc in your browser and site1 comes up.
The development site will behave the same as it will on a production server.
As with IIS for Apache PHP and Perl would have to also be installed.
Also if you wish to test Zend or Ion Cube those too will need be installed.

Any changes you make to Apache .conf files will require a Apache restart for them to take effect.
From my experience Apache is quite good on Windows as I have had no problems at all.
For me IIS was fun at first back in the 1990's but due to it's draw backs I think Apache is better.
 

Read 2780 times Last modified on Sunday, 26 April 2015 00:02

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.

 

 

Website Tips Search

Registered User