• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

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

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  http://www.myserver.com/~host3  , 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
</Directory>

UserDir public_html

NameVirtualHost (my.ip.address)

<VirtualHost (my.ip.address)>
DocumentRoot /home/host3/public_html
ServerName www.host3.com
ServerAlias www.host3.com host3.com
ServerAdmin webmaster@host3.com
</VirtualHost>
0
alcibiades
Asked:
alcibiades
2 Solutions
 
BlazCommented:
Are you trying to access www.host3.com or www.myserver.com?

Also your DocumentRoot in host3 virtual host is wrong
DocumentRoot /home/host3/public_html
0
 
xDamoxCommented:
Hi,

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

http://www.myserver.com/~host3

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

http://my.ip.address

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

0
 
alcibiadesAuthor Commented:
I am trying to access www.myserver.com/~host3/index.html

The domain registration for www.host3.com has not been setup yet.

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

 xDamox,

I have multiple virtual hosts. So http://my.ip.address is not going to resolve to host3 without additional information. www.myserver.com resolves to the master zone my.ip.address.com
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Gabriel OrozcoSolution ArchitectCommented:
> I want to serve  /home/public_html/host3/index.html
> but when I go to  http://www.myserver.com/~host3  , 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
0
 
alcibiadesAuthor Commented:

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.
0
 
xDamoxCommented:
Hi,

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
    </Limit>
    <LimitExcept GET POST OPTIONS>
        Order deny,allow
        Deny from all
    </LimitExcept>
</Directory>
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now