Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Regular Coder
    Join Date
    Dec 2011
    Posts
    186
    Thanks
    0
    Thanked 1 Time in 1 Post

    Apache serves page fine on port 80, but will not with VirtualHost on port 81

    I have a fedora server and Windows XP machine behind a router on my home network. I'm using this set up to learn to build a server.

    I want to use Apache to run 2 servers. The first uses the main config file, httpd.conf, and runs on port 80. This server works fine. It servers up the index file just fine.

    I want to use a <VirtualHost 192.168.0.2:81> directive for the second server, so I can have it listen on port 81. So far it has not worked. The error log I put in the Virtual Host did not show any errors as far as I could tell.


    Some facts:
    Code:
    Both servers listen on 192.168.0.2
    
    Port 81 is open in iptables
    
    The main server, httpd.conf port 80, responds to all requests for the index file listed in it's "DirectoryIndex" directive.
    
    The virtual host does not serve the file listed in it's "DirectoryIndex" File.
    
    The same file that is served on port 80 (httpd.conf) is not served on port 81 (virtualhost>.
    
    I can call the main server by domain name or ip. Both work
    
    I call the virtual host by 192.168.0.2:81 , because I have no ServerName Directive on this port.

    httpd.conf:
    Code:
    User Apache
    Group Apache
    Listen 80
    ServerName host.domain.com
    Use Canonical Name  On
    DocumentRoot "/var/www/html"
    
    
    <Directory />
    Options FollowSymLinks
    AllowOverride None
    </Directory>
    
    
    <Directory "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow, deny
    Allow from all
    </Directory>
    
    DirectoryIndex registration.html (this file served fine)

    The Virtual Host
    Code:
    <VirtualHost 192.168.0.2:81>
    DocumentRoot /var/www/html 
    
    (DocumentRoot in httpd.conf had quotes around it. I put them around this line as well. It didn't fix it.)
    
    
    DirectoryIndex registration.html (this same file not served when placed here)
    
    (This file is not served. This same file in httpd.conf directory index is served fine)
    
    </VirtualHost

    Does anyone know what I'm missing? Thank you

    UPDATE: Apache will not start when Listen directive in httpd.conf set to port 80.
    Last edited by milesdriven; 03-20-2012 at 05:09 PM.


 

Posting Permissions

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