Friday, 25 November 2011

Apache cannot write to NFS mounted folder. File size is always zero.

Apache cannot write to NFS mounted folder. File size is always zero.

I have mounted a folder from server1 to server2 to the media folder located in the document root of Apache web-server.. Which is installed in server2. But when the Apache tries to write a file to this mounted folder an actual file is created but the content is not written.. it always shows file size as 0 bytes. Please help me to resolve this issue.

these are the steps I used to setup NFS mount..
For this I have chosen 2 Linux machines running CentOs 5.4

1) I have chosen server1(192.168.1.1) as NFS server And Server2((192.168.1.2)) as client.

2)installed nfs-utils on both machines using the command yum install nfs-utils.

3) Then I have edited the file /etc/exports on server1 using vim and added the entry
/home/user/media 192.168.1.2(rw)
Then saved it
Again added necessary entry in host.allow & host.deny files
Then started the portmap service and nfs service.
I want these files to be manipulated by appache on server2 so I have set the user and usergroup to apache:apache for this folder.

4) Now from server2 I have started portmap and nfs.. then mounted this folder.. using the command
mount 192.168.1.1:/home/user/media /var/www/html/media
Every thing was correct till here... The folder from the server1 is now listed in server2.. i can now modify any file or folder inside the mounted folder from server2. But when Apache tries to write a file to this mounted folder an actual file is created but the content is not written.. it always shows file size as 0 bytes.

Is this issue related to the user permission? or is this a serious mistake I did during my NFS mount steps? Can someone please help me in resolving this issue..

Thanks!

No comments:

Post a Comment