I hope this is the right place for this. I have a Ubuntu 11.10 server with Apache on. Apaches doc root is on a shared folder sourced via cifs from a windows Machine.
All this is fine on every network I have set it up on until today when I came to set it up at home.
I am viewing my website, on my Apache server in a web browser (lets say Firefox) and every couple of refreshes I get a 403 response or no data at all back for certain files from the servers cif share in Firebug.
Now through the process of elimination I have been able to determine it is cifs. I came to this conclusion by copying my doc root to a local folder on the Ubuntu install and trying to get the same behaviour, which I did not.
Now I understand this is very hard to grasp through plain text so here are a couple of pictures to describe the problem.
This first picture shows everything on one refresh and it is all fine:
This picture shows the next refresh, as you can see Firebug responds that apache suddenly cannot access my files, not only that but what Firebug is not reporting that there are also images missing off of that page. I should mention the images actually come from DB, so not sure how cifs is interferring with that but the images work with the local version of the site so it must be.
This problem is intermitant.
Now I did try and Google this but then I realised, after a couple of tries, I wasn't actually quite sure what to Google for.
Can some one point me in the right direction to diagnose my problems? Maybe some one has had this problem before and can share their solution?
Thanks,
Update: Ok so I did a little searching around in the APache logs and it comes up with this:
[Thu Jan 19 20:59:03 2012] [error] [client 192.168.153.1] (12)Cannot allocate memory: file permissions deny server access: /server_ws/htdocs/css/960.css, referer: http://stagex.co.uk/stream
I have seen this error quite a lot and it always has a different meaning. So first I decided to check the actual file permissions in Linux before I did a refresh after this problem:
drwxrwxrwx 1 www-data sam 0 2012-01-17 18:33 .
drwxrwxrwx 1 www-data sam 4096 2012-01-17 21:40 ..
-rwxrwxrwx 1 www-data sam 10641 2012-01-17 18:33 960.css
-rwxrwxrwx 1 www-data sam 0 2012-01-20 18:58 c_css.css
-rwxrwxrwx 1 www-data sam 129488 2012-01-17 18:33 main.css
-rwxrwxrwx 1 www-data sam 1086 2012-01-17 18:33 reset.css
drwxrwxrwx 0 www-data sam 0 2012-01-17 18:33 .svn
Everything looks tip top there. So I checked Windows to make sure I will always have access to it. I have shared the server_ws folder from windows using the built in protocol and have assigned my Windows user "Sam" as the owner. I have told cifs to hook into this Windows like so:
//192.168.0.2/server_ws/the_stage /media/server_ws cifs username=Sam,password=****,rw,uid=www-data,gid=sam,iocharset=utf8,dir_mode=0777,file_mode=0777 0 0
Nothig immediately wrong there and if there was something terrible there why would it only happen every so oftern.
Though now that I've found the error in Apache Ima do more Google searching.
If anyone knows something please let me know :)
I think I found it. This is actually a subset of a more common problem: http://alan.lamielle.net/2009/09/03/windows-7-nonpaged-pool-srv-error-2017. I found this solution a long time ago for another problem but never thought of using it here.
It seems on some installs you must tell Windows to act as a file server by setting the registry keys above. If you do that then it seems Windows will always allocate the resources required to complete a transfer even if its intensive.
I cannot get my server to repeat this problem now :D.
Thank you, Luis for you help without the thought of checking Apache again I would never have got to the bottom of it.
I'll have to go out on a limb here and guess a bit. I can't be sure which directory the
DocumentRoot
forstagex.co.uk
points to.Whichever it is, you can wait until you get an error and impersonate the www-user using sudo, and then try to find which folder has wrong permissions:
If this fails,
cd /
and thencd
to each path component in turn until you get a permission-denied error.If you're really serving from
/media/server_ws
, it's possible that the permissions on/media
are being changed under your feet. If you are suffering from this, I'd mount it under/srv
which I think it's the usual place.I've found myself returning to this question and its answers because as we onboard new hires, we seem to have to redo this step. Therefore, I created a registry file based off the accepted answer's link so we can easily make the adjustment that I wanted to offer up.
You'll want to open notepad, and enter the following:
Save the file as
whatever_you_want.reg
and run it (will require administrator access, so you'll likely have to accept UAC). This has been tested on Win 7 x64 Prohope this helps!