Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

A great way to set up websites on your local server.


TB

Recommended Posts

Posted

A great way to setup website(s) on a local windows server is to have them called by their own domain name.

ie. http://www.yoursite.home rather than http://localhost/yoursite

 

The following setup information is used:

(Obviously change the required information if your setup differs slightly.)

Windows NT/2000/XP - c:windows (XP) or c:winnt (NT/2000)

Apache 1.3 or 2.0 - c:apache groupapache (Apache 1.3) or c:apache groupapache2 (Apache 2.0)

PHP 4 - c:php

Website directory - c:websites

 

You will need to modify the following files:

(These files can be modified with notepad or wordpad)

c:windowssystem32driversetchosts (XP) c:winntsystem32driversetchosts (NT/2000)

c:apache groupapacheconfhttpd.conf (Apache 1.3) or c:apache groupapache2confhttpd.conf (Apache 2.0)

 

Add the following to your 'host' file:

127.0.0.1       localhost

127.0.0.2       www.yoursite.home

NOTE: It's advisable to name your local site with the extension '.home' so it doesn't conflict with an existing domain name on the internet. If you name your local site with '.com' and try to load the real 'yoursite.com' you will get your local site since your computer searchs the 'hosts' file before searching for an internet DNS.

If you have multiple sites, your need to add the next site to a new line.

Example. '127.0.0.3 www.yourothersite.home' (Increment each new websites IP address by 1.)

 

Add the following to your 'httpd.conf' file:

(You will see information on 'Virtual Hosts' at the end of your 'httpd.conf' file.)

<VirtualHost 127.0.0.2>

   ServerAdmin webmaster@locahost

   DocumentRoot c:/websites/yoursite

   DirectoryIndex index.php default.php index.fire index.html index.htm default.html default.htm

   ServerName www.yoursite.home

   ErrorLog logs/www.yoursite.home-error_log

   CustomLog logs/ranru.turningbase.home-access_log common

   ScriptAlias /cgi-bin/ c:/websites/yoursite/cgi-bin

</VirtualHost>

 

Restart your Apache service.

(Can be done via to 'Apache monitor' or via the command line.

Command line: 'c:apache groupapacheapache -k restart' (apache 1.3 or 'c:apache groupapacheapache -k restart' (Apache 2.0)

 

Now you're ready to use your new domains.

Example: 'http://www.yoursite.home'

 

Hope this helps,

Tony

"The price of success is perseverance. The price of failure comes much cheaper."

Posted

I moved this to the Tips & Tricks, seemed at home there :D

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Posted

Hey Tony, that's an excellent tip!

 

I have always known that you could do this, but have always been too much of a lazy bugger to work it out for myself. Thanks for the tip.

Posted

Tony, great tip - this one should definately go into Wiki!! :D

Posted

Thanks for the feedback everyone!

 

Makes it worthwhile documenting these things, knowing that it's helpful to others...

 

Cheers,

Tony

"The price of success is perseverance. The price of failure comes much cheaper."

  • 4 weeks later...
Posted

I just wanted to add that if you have access to a WindowsNT DNS Server, you can also point a Forward Lookup Zone to the IP address of your local server. Just create a new Forward Lookup Zone with the domain name you want to use for the test site, such as:

 

testsite.com

 

Then add a New Host to the new Zone you just created, and point it to the IP of your test server:

 

Host www 192.168.1.20

 

If other PCs on your network use this DNS server, then you've essentially created a little intranet, and everyone on the network can review your site by typing in testsite.com on their URLs. Works great for developing new sites in a corporate environment without waiting for external DNS changes to be made.

  • 11 months later...
Posted

Thank you, Thank you, Thank you, Thank you, Thank you, Thank you, Thank you, Thank you, Thank you, Thank you, Thank you, Thank you, Thank you !!

 

I just spent about an hour looking for exactly this on the net !! As this topic hasn't been added to in a year i thought i would bump it !!

 

Im implementing a mutlistore, multi domain system and now at least i can emulate my server !

 

Thanks again !

  • 5 months later...
Posted

will this work for legit domains as well? ive been having problems setting up two domains in apache and nothing ive tried so far will work. is this just for local lookup or does this work outside the local lan as well? meaning for name resolution.

 

thanks

 

nick

Posted

Excellent tip!

 

Just yesterday I spent several hrs before discovering, that PHP setcookie just can't set cookie on localhost, it requires domain-like name :)

  • 4 weeks later...
Posted

Hi

 

Can anyone help me? The above worked well before I installed Win Xp SP2.

After installing SP2 on my PC, I can't access using www.mydomain.home.

I can access http://localhost/phpmyadmin but not www.mydomain.home in other directory. my directory is under c:/website.

 

 

Can anyone tell me what when wrong? Any help will be greatly appreciated. Thank you. :'(

  • 2 months later...
Posted
Hi

 

Can anyone help me? The above worked well before I installed Win Xp SP2.

After installing SP2 on my PC, I can't access using www.mydomain.home.

I can access http://localhost/phpmyadmin but not www.mydomain.home in other directory. my directory is under c:/website.

Can anyone tell me what when wrong? Any help will be greatly appreciated. Thank you. :'(

 

I had the same problem! Was kinda desperate and nearly unstalled the SP2 :blink: but thank God.. (I prayed heh) Found the answer :lol: Download and install the following patch from Microsoft and the tips stated in this thread should work as usual.

 

Microsoft Patch

 

When in doubt, Pray! :thumbsup:

  • 2 weeks later...
Posted

If anybody's in need to a good apache, php, mysql package, check out Apache2Triad This is a fantastic package, which contains everythin your guna need to get ure own server up n running, in one neat package.

 

HTH

Fatmcgav

  • 7 months later...
Posted

Anyone help me with Active Directory DNS please?

 

I have a local Win2k3 server connected to a LAN which connectes to the internet via a router. I've setup Apache webserver on Win2k3 and configured for virtual hosts. Entering 10.0.0.3 in the browser address will take me to the wwwroot folder, and if I add a virtual host to the Apache config file then 10.0.0.3 takes me to the specified sub-folder of wwwroot, but I can't seem to setup dns so that entering a name eg http://website1 or http://website1.<win2k3_local_domain> will take me to the root of that virtual host.

 

I see in DNS management that Forward Lookup zones can be added, but still can't get it to resolve a name in the browser address. Any clues please?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...