Jump to content

Archived

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

Onno

Need to simulate webdomains

Recommended Posts

Apache is not my strongest side. But I\'m learning

Any way I need for a PHP script to simulate url adresses on my Localhost.

Now i acces a webpage on my locahost by 127.0.0.1

but 127.0.0.1 should become www.onno.org for example

and www.tom.org etc...

 

How do I put this in my httpd.conf script. Remember this is on my local host without any bind

 

Using Red Hat 9.0

And apache 2.x

Share this post


Link to post
Share on other sites

First assign the names in your hosts file. On my BSD box, it\'s /etc/hosts ... I can only assume that it\'s in a similar location in RH.

 

Something like this should do:

127.0.0.1    www.onno.org

127.0.0.1       www.tom.org

 

Test, and make sure that the names resolve locally. In BSD, changing /etc/resolv.conf to instruct the resolver to check the hosts file before the nameserver is simply a matter of which line comes first. Like I said, not sure about RH.....

 

Secondly, you need to enable Name-based virtual hosting in httpd.conf. Here\'s an example:

#

# Use name-based virtual hosting.

#

NameVirtualHost *:80



# VirtualHost example:

# Almost any Apache directive may go into a VirtualHost container.

# The first VirtualHost section is used for requests without a known

# server name.

   

<VirtualHost *>

   ServerName www.onno.org

   DocumentRoot /www/onno

   ServerAdmin me@localhost

</VirtualHost>

Restart apache, voila!

Share this post


Link to post
Share on other sites

Yes, its indeed that easy.

 

Just vi /etc/hosts and edit it...

 

If you don\'t know you never know unless somebody tells you :D

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.