Find the answer to your Linux question:
Results 1 to 3 of 3
Hello Friends, I am new to Linux (actually I m preparing for RHCE exam myself), I m using both Fedora core 1 & 2 & Apache 2.0.46 on two different ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2004
    Posts
    1

    apache virtual host. all sites are opening same webpage.


    Hello Friends,
    I am new to Linux (actually I m preparing for RHCE exam myself), I m using both Fedora core 1 & 2 & Apache 2.0.46 on two different machines, and I have some problem working with apache virtual hosting.

    /etc/hosts is like this;

    # Do not remove the following line, or various programs
    # that require network functionality will fail.
    127.0.0.1 localhost.localdomain localhost
    192.168.10.1 comp1.bhaskar.com comp1
    192.168.10.1 comp1.yahoo.com www.yahoo.com
    192.168.10.1 comp1.rediff.com www.rediff.com
    192.168.10.1 comp1.linux.com www.linux.com

    And my /etc/http/conf/http.conf is like this

    <VirtualHost >
    ServerAdmin webmaster@yahoo.com
    DocumentRoot /var/www/html/yahoo
    ServerName www.yahoo.com
    ErrorLog logs/yahoo.com-error_log
    CustomLog logs/yahoo.com-access_log common
    </VirtualHost>

    <VirtualHost >
    ServerAdmin webmaster@rediff.com
    DocumentRoot /var/www/html/Rediff
    ServerName www.rediff.com
    ErrorLog logs/rediff.com-error_log
    CustomLog logs/rediff.com-access_log common
    </VirtualHost>

    <VirtualHost >
    ServerAdmin webmaster@linux.com
    DocumentRoot /var/www/html/Linux
    ServerName www.linux.com
    ErrorLog logs/linux.com-error_log
    CustomLog logs/linux.com-access_log common
    </VirtualHost>

    My problem is that previously www.linux.com, www.yahoo.com were opening (but never www.rediff.com), But now when I m trying to browse any site in my browser it take me to a page where it says INDEX OF /. I have all the index.html files in all the folders.

    one person told me to Add these lines in each of your virtual hosts and restart apache.

    <Directory "your-doc-root">
    Options -Indexes -MultiViews
    DirectoryIndex index.html
    </Directory>

    When i add these lines in each of your virtual hosts and restart apache. im able to browse www.linux.com, but www.yahoo.com open the same linux page and im still unable to browse www.rediff.com (it still take me to a page INDEX OF /)
    Can any body help me? Did I have done something wrong?need some serious help. stuck on this from long time.

  2. #2
    Linux Engineer jledhead's Avatar
    Join Date
    Oct 2004
    Location
    North Carolina
    Posts
    1,077
    for apache problems, this is always a good place to start
    http://httpd.apache.org/docs/vhosts/examples.html

    also THIS would be a good google search in this situation.

    and also http://www.linuxforums.org/forum/top...t=virtual+host

    it was found with an easy search on this site.

    google and search is your friend

  3. #3
    Linux Enthusiast
    Join Date
    Jun 2002
    Location
    San Antonio
    Posts
    621
    The reason you are getting the same page for the two websites is because you don't have the VirtualHost directives right. Try to be specific, since apache may be listening on all ports. Here is what I would do:

    Code:
    NameVirtualHost 192.168.10.1&#58;80
    
    <VirtualHost 192.168.10.1&#58;80>
    ServerAdmin webmaster@yahoo.com
    DocumentRoot /var/www/html/yahoo
    ServerName www.yahoo.com
    ErrorLog logs/yahoo.com-error_log
    CustomLog logs/yahoo.com-access_log common
    </VirtualHost>
    
    <VirtualHost 192.168.10.1&#58;80>
    ServerAdmin webmaster@rediff.com
    DocumentRoot /var/www/html/Rediff
    ServerName www.rediff.com
    ErrorLog logs/rediff.com-error_log
    CustomLog logs/rediff.com-access_log common
    </VirtualHost>
    
    <VirtualHost 192.168.10.1&#58;80>
    ServerAdmin webmaster@linux.com
    DocumentRoot /var/www/html/Linux
    ServerName www.linux.com
    ErrorLog logs/linux.com-error_log
    CustomLog logs/linux.com-access_log common
    </VirtualHost>
    Now you need to ensure that each of those directories contains an index.html page:
    Code:
    ls -l /var/www/html/Linux/index.html /var/www/html/Rediff/index.html /var/www/html/yahoo/index.html
    This should show that one of the directories may be missing an index.html file. It may also be that your browser has been open for days and may have the page cached.

    Best,

    Samuel

    PS: yes, my browser will normally stay open for weeks at a time.
    I respectfully decline the invitation to join your delusion.

  4. $spacer_open
    $spacer_close

Posting Permissions

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