Jump to content

Need to simulate webdomains


Onno

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

Link to comment
Share on other sites

  • 2 weeks later...

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.