SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Zealot
    Join Date
    Oct 2001
    Location
    Montreal, Canada
    Posts
    169
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Creating VirtualHost with Apache on Localhost

    As I dev my own web site and take care of the php coding of one of my friends web portal, I needed not to have both mixed (like accessing mine at localhost and my friend's at localhost/friend) The idea was to have two different document_root.

    I did the following steps:

    1- In the file hosts, I added this line 127.0.0.2 friend.localhost

    2- In the httpd.conf file, I added the following:
    Code:
    NameVirtualHost 127.0.0.2
    
    <VirtualHost 127.0.0.2>
        ServerAdmin me@friend.localhost
        DocumentRoot "e:\friend"
        ServerName friend.localhost
        ErrorLog logs/friend/error.log
        CustomLog logs/friend/access.log common
    </VirtualHost>
    I restarted Apache and this works. When browsing to http://localhost, I have my web site, when browsing to http://friend.localhost I get my friend's web site.

    I dont know if there are there any security risks doing that? I don't know, but I assume not because all IP starting with 127 are loopbacked to 127.0.0.1.

    Mike
    Last edited by ALSLG; Aug 28, 2002 at 19:09.
    Dis donc, qu'est-ce qu'il dit ce mec? Hein? Je comprends rien...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •