473,386 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Settings up additional 'http://localhosts' (ie. localhost2, localhost3) in apache

Hi,

My knowledge of apache is nothing impressive,. I purely use it to run
local websites. I was wondering however, if it is possible to create
more local domains like localhost. I like my local websites to be able
to run in a simulated environment as my remote host. This would maybe
run like http://localhost, http://localhost2, http://localhost3 ...

Can it be done? Btw, Im running apache on Windows.

Burnsy

Nov 23 '05 #1
6 13409
bizt wrote:
Hi,

My knowledge of apache is nothing impressive,. I purely use it to run
local websites. I was wondering however, if it is possible to create
more local domains like localhost. I like my local websites to be able
to run in a simulated environment as my remote host. This would maybe
run like http://localhost, http://localhost2, http://localhost3 ...

Can it be done? Btw, Im running apache on Windows.

Burnsy


How about asking in an Apache newsgroup? Or, the Apache users maillist
is even better.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 23 '05 #2
Edit your HOSTS file. You will find it in
C:\Windows\System32\Drivers\Etc\.

Nov 23 '05 #3
>My knowledge of apache is nothing impressive,. I purely use it to run
local websites. I was wondering however, if it is possible to create
more local domains like localhost. I like my local websites to be able
to run in a simulated environment as my remote host. This would maybe
run like http://localhost, http://localhost2, http://localhost3 ...

Can it be done? Btw, Im running apache on Windows.


If you have access to DNS (e.g. you run a nameserver on your machine
or your LAN), you can point additional names (preferably ones not
in use by someone else, say, using the top-level domain ".local",
which will likely never be used on the global Internet), at 127.0.0.1
or the IP address of your server machine, then configure them as
virtual hosts in Apache. This will be seen only by hosts that use
your nameserver.

If you don't have access to DNS, you can do the same thing with the
HOSTS file on all the machines you want to have see the sites, then
configure virtual hosts on Apache.

Gordon L. Burditt
Nov 23 '05 #4

Chung Leong wrote:
Edit your HOSTS file. You will find it in
C:\Windows\System32\Drivers\Etc\.


your HOSTS probly says
127.0.0.1 localhost

below it, add
127.0.0.2 site2

goto your httpd.conf (in apache's dir, or somewhere nearby)
look for this (around line 150) : Listen 127.0.0.1:80 or something like
it. under it, add
Listen 127.0.0.2:80

near the bottom of httpd.conf, look for the virtualHost stuff. add this
under whatever is there:
<VirtualHost 127.0.0.2:80>
ServerName site2
DocumentRoot "C:/My Documents/_websites/folderforSite2/www/"
</VirtualHost>

Thats what I do, I have a test host for 23 sites that way, just adding
1 to the IP each time. If there are less steps i could take, I'd like
to know!

--
j

Nov 23 '05 #5
"bizt" <bi******@yahoo.co.uk> wrote in
news:11*********************@g43g2000cwa.googlegro ups.com:
Hi,

My knowledge of apache is nothing impressive,. I purely use it to
run local websites. I was wondering however, if it is possible to
create more local domains like localhost. I like my local websites
to be able to run in a simulated environment as my remote host. This
would maybe run like http://localhost, http://localhost2,
http://localhost3 ...

Can it be done? Btw, Im running apache on Windows.


Just add the domain names you wish to use in your hosts file
(\windows\system32\drivers\etc IIRC), then comes the tricky part if
you want to use more than one simultaneously. Study up on virtual
hosting for apache. It will allow you to run more than one
site(domain name) from the same server.

I serve 5 sites (stanmccann.us in my sig is just one of them) from my
little Linux box at home, then I also have test.org available to all
machines on my LAN. An added benefit of this method is I *can* access
test.org from anywhere by setting it in the local hosts file.

--
Stan McCann "Uncle Pirate" http://stanmccann.us/pirate.html
Webmaster/Computer Center Manager, NMSU at Alamogordo
http://alamo.nmsu.edu/ There are 10 kinds of people.
Those that understand binary and those that don't.
Nov 23 '05 #6
>> Edit your HOSTS file. You will find it in
C:\Windows\System32\Drivers\Etc\.


your HOSTS probly says
127.0.0.1 localhost

below it, add
127.0.0.2 site2

goto your httpd.conf (in apache's dir, or somewhere nearby)
look for this (around line 150) : Listen 127.0.0.1:80 or something like
it. under it, add
Listen 127.0.0.2:80

near the bottom of httpd.conf, look for the virtualHost stuff. add this
under whatever is there:
<VirtualHost 127.0.0.2:80>
ServerName site2
DocumentRoot "C:/My Documents/_websites/folderforSite2/www/"
</VirtualHost>

Thats what I do, I have a test host for 23 sites that way, just adding
1 to the IP each time. If there are less steps i could take, I'd like
to know!


There are two methods of having Apache handle multiple sites on the
same server. The one you indicate requires multiple IPs on the
server. While you aren't likely to run out of IPs for localhost
any time soon (you've got about 16 million of them), running out
of public IPs can be a real problem, especially if you're on a DSL
line which only gives you one. Using up a whole class C (253 usable
addresses) or more for one web hosting company web server is a bit
of a waste.

The other method of doing virtualhosting is to put them all on the
same IP address (and the same port). The browser, except for those
that are SERIOUSLY out of date (and were seriously out of date in
2000), such as Netscape 2.*) will send a Host: header with the
request, indicating which host name it was for. Apache will sort
out which virtualhost is being addressed from the host name. If
you send it a host name it doesn't recognize, you'll get a default
site. Read the Apache manual for more details. You *need* to have
working DNS (or edit the HOSTS file) since putting in an IP address
to the browser will not let the browser know which site you want.

Gordon L. Burditt
Nov 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Johan den Boer | last post by:
Hi, Tried installation with apache 2.0.47. But nothing is working. Copied all the dll's and .ini file to the right locations. Changed the httpd.conf file as well. Here is what I added in...
1
by: Peter Chatterton | last post by:
I want to use jdb for debugging a servlet. I'm using Apache/JServ with jdk 1.4 (via Textpad on win2K SP 3). The 'gospel' I'm using is: 'Start the server manually and record the password for...
5
by: Ankit Aneja | last post by:
This is my problem. I am using Visual 2003, .Net framework 1.1 and the Application Block I configured the DAAB using the Enterprise Library Configuration now this is the error which is coming ...
5
by: raisins | last post by:
This is kind of an obscure question, and I hope someone has a clue what's going on. I've got PHP4 running on Apache 1.3 on win32, and whenever I request a URL like so: http://localhost/tag/ It...
2
by: joe | last post by:
Hi, I am new to both Apache and PHP. I have installed Apache 2.0.59 and PHP 5.1.6 on WinXP Home. I can run test.php page from default DocumentRoot "C:/Program Files/Apache...
4
by: liyanage | last post by:
I recently worked on error handling and three related issues/questions came up. 1.) I am trying to trigger Apache ErrorDocument handlers by setting appropriate HTTP status codes in my PHP...
0
by: Martin Sebor | last post by:
May 1, 2008 The Apache C++ Standard Library project is pleased to announce the release of stdcxx 4.2.1. The distribution can be downloaded from one of the Apache Download Mirrors, such as:...
9
by: Christopher Koeber | last post by:
Hello, I am attempting to perform a PHP installation on an Apache 2.2.6 web server instance that is loaded on a Windows 2003 server operating system (R2 SP2). I have a third party application...
2
by: ramprakashjava | last post by:
sorry still that error exist , how to avoid this deprecated method overriding in my netbeans ! In Bundled tomcat log it shows Dec 30, 2009 9:03:45 PM...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.