Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mapping hostname to ip address 1

Status
Not open for further replies.

Stretchwickster

Programmer
Apr 30, 2001
1,746
0
0
GB
Hi there,

Throughout today I've been trying to setup Apache 2.2.12 (installed as part of XAMPP 1.7.2) in a local development environment such that maps to I have forced Apache to listen on 127.0.0.3:80 so that I can run IIS concurrently on 127.0.0.2:80 (I have setup IIS to listen only on this IP address & port). For the purposes of configuring this Apache mapping, I've stopped IIS running.

Currently, successfully shows the XAMPP welcome page and shows "Internet Explorer cannot display the web page". In order to achieve this mapping, I've tried a number of things, but after a recent reinstall of XAMPP the only mods I've made are as follows:
Code:
Listen 127.0.0.3:80
...
ServerName apache:80
If I only wish to map this IP address to a single website/hostname, do I need to define NameVirtualHost and VirtualHost directives in httpd-vhosts.conf?

If so, would this syntax be correct:
Code:
NameVirtualHost 127.0.0.3:80

<VirtualHost 127.0.0.3:80>
    DocumentRoot "C:/xampp/htdocs/"
    ServerName apache
</VirtualHost>

Any advice/pointers would be gratefully received.

Clive
Runner_1Revised.gif

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Well, the fastest way to play with it would be to edit your hosts file: C:\WINDOWS\system32\drivers\etc\hosts and put in a line something like:

127.0.0.3 apache


Try that and see if you can get it to work.

You would have to make some kind of mapping on whatever DNS server (or maybe WINS - but that's not my cup of tea) you are using to make a permanent mapping, or use a real domain name that maps to an address.
 
Donbo01 is correct. Your problem is a DNS issue, not an apache issue. When you type in you are telling the browser to fine the URL "apache." (and retrieve the index.html).

Not surprisingly, apache. does not exist. Are you running on a LAN that has named devices on it? If not, and it is your own LAN, you could install a DNS server and provide this capability, but you will need to either use totally static IP addresses or link them with your DHCP server.
 
Many thanks to you both for your input.

I'm sure I tried donb01's suggestion before, but after uncommenting the "127.0.0.3 apache" line in my hosts file, typing in my browser now finds the XAMPP welcome page - hooray!

Better still, if I start XAMPP first, then start IIS, I can see content served by both web servers simultaneously; Apache content via and IIS content via
Clive
Runner_1Revised.gif

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Not sure if you would have had to reboot or logout / login after editing the hosts file or it will just work, but that may have been a contributor.

Glad to see it's working now.
 
Now you mention it, this time I did reboot after making the change to the hosts file, last time I don't believe I did. So I think you're spot on there.

I think I confused myself into thinking that the hosts file only impacted IIS, and therefore the problems I was running into were related to Apache. Dumb logic, I know!

Clive
Runner_1Revised.gif

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
The hosts file on windows is a common target for bad guys who have been known to put all kinds of bad stuff in there. I'm too lazy to look at mine again, but normally it only has an entry in it for 127.0.0.1 localhost.

If you are ever having really strange problems with your computer relating to surfing the internet that's the first place I look. If there are a lot of definitions in the file that look like IP addresses and websites then I would make a backup copy of the file just in case I screw something up, and then delete out everything except the localhost entry.

That local file is typically checked first, and if it doesn't have the answer for where you want to go THEN it first hits the DNS. So you can see how if this file is screwed up it can cause a few problems...


 
Thanks for the tip. My understanding of how it works is a bit clearer now, thanks to your input. Mine did have a single localhost entry until I added my entries.

Clive
Runner_1Revised.gif

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top