EditWrx Knowledge Base Home
 Search       Login   Register   Members   Help   Home 
Search by username


Running an Apache server on XP
 Moderated by: Keith  
 New Topic   Reply   Print 
AuthorPost
Keith
Moderator
 

Joined: Fri Apr 8th, 2005
Location:  
Posts: 578
 Posted: Mon May 29th, 2006 02:37 am
 Quote  Reply 
A lot of EditWrx user have asked how to set up an Apache server on their XP desktop/laptop that will run EditWrx.

 

Install Apache for Windows from Apache.org. Install in the default C:\Program Files\Apache Group folder. If you make Apache a "service" it will start when XP boots up. If you make it a "program" you will need to start Apache like any other program and it will take up space in the taskbar.

Install Perl from ActiveState.com. Install in the default C:\Perl folder.
Open Explorer File Manager, click Tool>Folder Options>File Types. Locate the entery for PL. Make an identical entery for CGI. This allows you to use both .pl and .cgi extensions.

Assuming that development on the XP server will end up being transferred to a propduction server, you need to set up a path structure on XP that mirrors the path structure on the production server. For example: EditWrx.com on a Plesk/Unix server would be found at /home/httpd/vhosts/editwrx.com/httpdocs, so EditWrx.com on the XP server should placed at C:/home/httpd/vhosts/editwrx.com/httpdocs.

Assuming that the XP development server should be able to handle multiple domains, Apache will need to be set up as a virtual-hosting server. Open C:\Program Files\Apache Group\Apache\conf\httpd.conf in a plain text editor.

1) Find
UseCanonicalName On
and change to
UseCanonicalName Off

2) Find
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache/cgi-bin/"
change to
#ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache/cgi-bin/"

3) Find
#NameVirtualHost *
change to
NameVirtualHost *

Apache's http.conf will contain many other wrong settings but they can be ignored because they can be corrected in the Virtual Host tables.

You now need to setup a Virtual Host table for each domain you want Apache to service. This is a virtual host table example for EditWrx.com

<VirtualHost *>
    ServerAdmin supporte@dowebs.com
    DocumentRoot C:/home/httpd/vhosts/editwrx.com/httpdocs
    <Directory "C:/home/httpd/vhosts/editwrx.com/httpdocs">
    AllowOverride All
 Options Indexes MultiViews ExecCGI Includes
    </Directory>
    ServerName editwrx.com
</VirtualHost>

The AllowOverride allows .htaccess files to set any Options. The default Options allow viewing a list of files if index.html is not present, running cgi executables, and running SSI includes.

Note that the ServerName has only "editwrx.com" and does not also list "http://www.editwrx.com". That means that the XP server will service only http://editwrx.com URLs while the XP machine will still find http://www.editwrx.com on the production server. That allows you to quickly flip back and forth between the XP development server and the production server simply by including or excluding the "www." in the URL.

Now, you need to tell your local XP machine to find the domain on the local server instead of looking for it on the internet. Whenever a browser first starts up it does not know where to find domains by their names. When you first request a domain by it's name in a URL, the browser asks the internet's DNS system to resolve the domain name's IP address. Once that is done, the browser keeps the IP in memory and does not ask the DNS system again until you close the browser. The trick here is that the browser always asks the computer it is on if it has an IP for the domain name before it asks the internet's DNS system. If you add an IP-domain pair to the computer's host file you can tell the browser to find the domain on your local server instead of on the production server.

Open the file C:\Window\System32\drivers\etc\hosts (it does not have an extension). Open in a plain text editor - not a word processor. Do not remove anything in the file unlerss you have reason to. On a new line add the IP 127.0.0.1 a space and the domain you want the XP Apache to service. For example:

127.0.0.1 editwrx.com

would tell the browser to find editwrx.com on the local Apache server. If you want to discontinue finding the domain locally, place a # in front of the line to comment the line (be sure to close and restart the browser).


 Current time is 05:10 pm




Powered by WowBB 1.62 - Copyright © 2003-2004 Aycan Gulez