You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Tz-Huan Huang <tz...@gmail.com> on 2009/03/12 05:41:14 UTC

Re: [users@httpd] 404 when first visit if userdir is mounted using autofs

On Wed, Mar 11, 2009 at 11:34 PM, Justin Pasher
<ju...@newmediagateway.com> wrote:
> Tz-Huan Huang wrote:
>>
>> Hi,
>>
>> In our www server the /home/* is mounted automatically
>> using autofs.
>>
>> When visiting a user's homepage via
>> http://hostname/~user first time, the httpd says
>> ``404 not found'', but after reloading page several times
>> all thing works.
>>
>> Is there any way to avoid this annoying behavior but still
>> using autofs? Thank you very much.
>>
>
> I use autofs and LDAP myself to mount home directories, and I've never had
> any problems with it, so I can't offer a direct solution. However, I can
> offer some suggestions.

Hi,

Thank you very much for your suggestions.

> 1) Do you ever have trouble doing an "ls /home/username" on a directory that
> is not mounted? Does it properly mount the directory and give you a
> directory listing?

Let me describe our environment in detail.
We have one main server running FreeBSD serves ldap/nfs/www,
and 10+ clients running Debian mount /home via autofs.
While some users need linux environment to run cgi, we select one
of the clients and install apache on it. Besides the www services,
there is no mounting problem for ssh usage.

> 2) If you request the http://hostname/~username from a browser, get a 404
> error, then do an "ls /home", do you see the "username" directory mounted?

Yes. I find that this might be not related to autofs --
while I have connected to the server via ssh and pwd is $HOME
(so my $HOME is mounted), I might still get 404 when visit my homepage.

> 3) After you successfully pull http://hostname/~username, unmount the home
> directory (umount /home/username), then try your request again to see if it
> gives out a 404 error again.

I cannot do this test while I don't find a page that causes the 404
error at this point.

The 404 error behavior is not predictable, sometimes it occurs
when I visit the page fist time, but sometimes it just runs well
whether it's the fist time visiting or after reloaded several times.
I still try to figure out the pattern.

> 4) Try restarting the autofs daemon (you have to make sure no home
> directories are currently in use to be successful). Sometimes daemons can
> just act up for no obvious reason.

While there are many users loged in now, I'll try to restart autofs
later to see if it helps.

> All in all, signs point more to an autofs problem and not Apache.

Thank you very much again, I'll continue monitoring the www services.
I'll report here if I find anything new.

Regards,
Tz-Huan Huang

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] 404 when first visit if userdir is mounted using autofs

Posted by Tz-Huan Huang <tz...@gmail.com>.
On Sat, Mar 14, 2009 at 6:07 AM, Justin Pasher
<ju...@newmediagateway.com> wrote:
> Tz-Huan Huang wrote:
>>>
>>> 2) If you request the http://hostname/~username from a browser, get a 404
>>> error, then do an "ls /home", do you see the "username" directory
>>> mounted?
>>>
>>
>> Yes. I find that this might be not related to autofs --
>> while I have connected to the server via ssh and pwd is $HOME
>> (so my $HOME is mounted), I might still get 404 when visit my homepage.
>>
>
> Check the Apache error log to be sure that the file it's actually trying to
> load is the exact path you are expecting. Obviously if the Apache error log
> indicates it's trying to load a different file than you expect, then the
> problem lies elsewhere. Try doing an "ls /full/path/in/error/log" to see if
> the system itself shows the file.
>
> Since I personally have not experienced this problem with autofs, I can't
> think of much else to look at.

Hi,

Think you very much, your advice is so helpful.
The log is like this:

access.log

58.114.198.68 - - [11/Mar/2009:10:30:02 +0800] "GET
/~linkh/demo-oxq/query.php HTTP/1.1" 404 278 "-" "Mozilla/4.0
(compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR
2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"
58.114.198.68 - - [11/Mar/2009:10:30:20 +0800] "GET
/~linkh/demo-oxq/query.php HTTP/1.1" 200 317 "-" "Mozilla/4.0
(compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR
2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"

error.log

[Wed Mar 11 10:30:02 2009] [error] [client 58.114.198.68] File does
not exist: /var/www/~linkh


When I visited the /~linkh/... first time, I got 404 error and the error.log
shows apache cannot find /var/www/~linkh, but several seconds later
I visited the same url again I got 200 and there is no error in error.log.

Maybe there is something wrong in my apache configurations?
Thank you very much.

Regrads,
Tz-Huan Huang

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] 404 when first visit if userdir is mounted using autofs

Posted by Justin Pasher <ju...@newmediagateway.com>.
Tz-Huan Huang wrote:
>> 2) If you request the http://hostname/~username from a browser, get a 404
>> error, then do an "ls /home", do you see the "username" directory mounted?
>>     
>
> Yes. I find that this might be not related to autofs --
> while I have connected to the server via ssh and pwd is $HOME
> (so my $HOME is mounted), I might still get 404 when visit my homepage.
>   

Check the Apache error log to be sure that the file it's actually trying 
to load is the exact path you are expecting. Obviously if the Apache 
error log indicates it's trying to load a different file than you 
expect, then the problem lies elsewhere. Try doing an "ls 
/full/path/in/error/log" to see if the system itself shows the file.

Since I personally have not experienced this problem with autofs, I 
can't think of much else to look at.


-- 
Justin Pasher

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org