Help! Cannot get apache to direct to my virtual hosts! What gives?

Posted on 2006-04-10
Last Modified: 2010-03-18
I am setting up Apache on a new dedicated server. Using the same httpd.conf data as the last server, but it is not resolving my host names correctly.

I want to serve  /home/public_html/host3/index.html

but when I go to  , I get "page cannot be displayed"

in the error_log, it says  " File does not exist: /var/www/html/~host3"

How do I get this to work?

from htttpd.conf:

<Directory />
    Options All
    AllowOverride All

UserDir public_html

NameVirtualHost (my.ip.address)

<VirtualHost (my.ip.address)>
DocumentRoot /home/host3/public_html
Question by:alcibiades
    LVL 16

    Expert Comment

    Are you trying to access or

    Also your DocumentRoot in host3 virtual host is wrong
    DocumentRoot /home/host3/public_html
    LVL 16

    Expert Comment


    The reason your getting this error is because you are access you server as follows:

    you have virtual hosting enabled so all you need to do to access that page is:


    replace my.ip.address with the one you used in virutal hosting.


    Author Comment

    I am trying to access

    The domain registration for has not been setup yet.

    I don't understand Blaz'z comment about the DocumentRoot. His example looks the same as mine .


    I have multiple virtual hosts. So http://my.ip.address is not going to resolve to host3 without additional information. resolves to the master zone
    LVL 19

    Accepted Solution

    > I want to serve  /home/public_html/host3/index.html
    > but when I go to  , I get "page cannot be displayed"

    I suspect you are trying to use personal home directory accounts when using http://....../~host3/index.html

    but that would work for /home/host3/public_html/ if you have setup your apache as default config. Since you (obviously) haven't configured this feature, apache will look at "$DocumentRoot/~host3" directory which is " File does not exist: /var/www/html/~host3"

    So, what to do?
    well, you can
    a) create a temporary virtual host for a domain you aldready own (this is my preferred method) and use it until you have the final domain ready
    b) enable mod_userdir, so your query get redirected to the users home_directory/public_html (you should garantee correct permissions on all files)
    c) move the test web site to a path under your DocumentRoot subdirectory and test using ip addresses

    hope this help

    Author Comment


    What you say makes me wonder if mod_userdir is not enabled. I thought it was. It is selected under Webadmin. I am going to check out your suggestions and see what I can learn.
    LVL 16

    Assisted Solution


    As Redimido said it does look like your wanting to use mod_userdir this would mean you will not need virtual hosintg

    In your httpd edit the following:

    UserDir enable host3 host2

    Notice you have to add the users on that line the reason for that is so root dosntget some web space. You will
    also need to uncomment out:

    <Directory /home/*/public_html>
        AllowOverride FileInfo AuthConfig Limit
        Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
        <Limit GET POST OPTIONS>
            Order allow,deny
            Allow from all
        <LimitExcept GET POST OPTIONS>
            Order deny,allow
            Deny from all

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
    Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now