Find the answer to your Linux question:
Results 1 to 5 of 5
I have two pcs, one running win xp and other RHEL v.4 with apache configured. Both are connected via cross cable. on the linux machine there is a file called ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2006
    Posts
    8

    virtual host on apache on p2p network


    I have two pcs, one running win xp and other RHEL v.4 with apache configured.

    Both are connected via cross cable.

    on the linux machine there is a file called index.html in /var/www/html
    which i am able to access by typing http://192.168.1.20 in the browser on my windows machine.( as linux machine has ip 192.168.1.20 : PLEASE NOTE THAT I HAVENT CONFIGURED DOMAIN NAME SYSTEM)

    Is it posiible to set up virtual hosts so that i can access more than one site without setting up DNS?
    If yes can anyone please tell me how?

  2. #2
    Just Joined!
    Join Date
    Nov 2006
    Location
    Vienna,Austria
    Posts
    4
    You can set up Virtual Host on different Ports and have one host an port 80 and anpther one on 81 as example - the apache docs have very good examples for that.

    http://httpd.apache.org/docs/1.3/vhosts/examples.html

  3. #3
    Just Joined!
    Join Date
    Nov 2006
    Posts
    8
    the extract below is from the httpd.conf file.
    Well my main concern is since i havent set up DNS what should i enter in the
    server name field of each virualhost below. suppose if i want to access website called site1 which is located in
    /var/www/site1 and site2 located in /var/www/site2


    Listen 80
    NameVirtualHost 192.168.1.20

    <VirtualHost 127.0.0.1>
    ServerName 192.168.1.20
    DocumentRoot /var/www/site1
    </VirtualHost>

    <VirtualHost 127.0.0.1>
    ServerName ????????
    DocumentRoot /var/www/site2
    </VirtualHost>


    192.168.1.20 is the ip adrress of my linux machine which i will be accessing from windows.

    when i type
    http://192.168.1.20 i get site 1

    how to i get site 2?

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Nov 2006
    Location
    Vienna,Austria
    Posts
    4
    ...
    Code:
       Port 80
        ServerName server.domain.tld
    
        NameVirtualHost *:80
    
        <VirtualHost *:80>
        DocumentRoot /www/domain
        ServerName www.domain.tld
        ...
        </VirtualHost>
        
        <VirtualHost *:80>
        DocumentRoot /www/subdomain
        ServerName www.sub.domain.tld
        ...
        </VirtualHost>
    --http://httpd.apache.org/docs/1.3/vhosts/examples.html

    try omitting the ServerName

  6. #5
    Just Joined!
    Join Date
    Nov 2006
    Posts
    8
    well it does seem to work at times, but not always, i think ill have to configure DNS now.
    I queried google for DNS but there wernt any articles for DNS configuration for two computers connected by cross cable.
    If you have any links please send me some

Posting Permissions

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