-1

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: Image of everything working

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. Image of the problem

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 :)

Sammaye
  • 719
  • 1
  • 8
  • 16
  • 1
    Perhaps you can find further information in the `error.log` file? grep facebox.js /var/log/apache2/error.log – Luis Bruno Jan 19 '12 at 23:01
  • Originally I didn't see anything special but I'll take another look tonight see if I can find some kind of error message or code, thanks – Sammaye Jan 20 '12 at 09:13
  • I actually found something this time around, I have updated the post thanks. – Sammaye Jan 20 '12 at 19:13

3 Answers3

1

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.

Sammaye
  • 719
  • 1
  • 8
  • 16
0

I'll have to go out on a limb here and guess a bit. I can't be sure which directory the DocumentRoot for stagex.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:

sudo -u www-data -s
cd /path/to/your/docroot

If this fails, cd / and then cd 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.

Luis Bruno
  • 480
  • 3
  • 9
  • Thanks for the reply, My DocumentRoot now points to `/srv/server_ws/htdocs` that is where I am serving the files from. I tried to find a permissions problem as ww-data but I could not, I even edited and save `960.css` when I got the problem. Tested it with another permissions problem too on a `query-ui.js` source file but that turned up nothing :(. I changed my mount point from media to srv just incase but still to no effect. Overall this seems a very elusive problem. – Sammaye Jan 21 '12 at 00:24
0

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:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]
"LargeSystemCache"="1"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters]
"Size"="3"

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 Pro

hope this helps!

Jon B
  • 149
  • 7