# Solving a 500 error

**URL:** <https://www.ruby-forum.com/t/solving-a-500-error/246327>\
**Category:** NGINX\
**Created:** [October 1, 2013, 6:53pm UTC](https://www.ruby-forum.com/t/solving-a-500-error/246327 "2013-10-01T18:53:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [October 1, 2013, 6:53pm UTC](https://www.ruby-forum.com/t/solving-a-500-error/246327/1 "2013-10-01T18:53:22Z")

</div>

Hi All,

I have an nginx install with the configuration below.

The server is a linux VM running under Virtual Box on my windows  
machine. The website / directory is made available as a sharename using  
Samba, which I connect to from Windows, so I can edit the files. I edit  
in windows, using familiar tools and then test using a browser, usually  
without restarting nginx or init-fastcgi.

This works fine for php files. When I edit one of two javascript files,  
the next request for a javascript file fails with a 500 error - even if  
the request is not for the changed file.

The version of nginx I am running is 1.2.6 compiled with the long  
polling module included.

Does anyone know what is happening?

Thansk,

Ian

This is my server confiig.

server {  
server\_name coachmaster3.anake.hcs;  
listen 80;  
fastcgi\_read\_timeout 300;  
index index.php;  
root /home/ian/websites/coachmaster3dev/htdocs;  
location = / {  
rewrite ^ /index.php last;  
}  
# serve php via fastcgi if it exists  
location ~ .php$ {  
try\_files $uri =404;  
include /etc/nginx/fastcgi\_params;  
fastcgi\_pass 127.0.0.1:9000;  
fastcgi\_param SCRIPT\_FILENAME  
$document\_root$fastcgi\_script\_name;  
fastcgi\_param CENTRAL\_ROOT $document\_root;  
fastcgi\_param RESELLER\_ROOT $document\_root;  
fastcgi\_param HTTPS OFF;  
}  
# serve static files  
try\_files $uri =404;  
# now to configure the long polling  
push\_store\_messages on;  
location /publish {  
push\_publisher;  
set $push\_channel\_id $arg\_id;  
push\_message\_timeout 30s;  
push\_max\_message\_buffer\_length 10;  
}  
# public long-polling endpoint  
location /activity {  
push\_subscriber;  
push\_subscriber\_concurrency broadcast;  
set $push\_channel\_id $arg\_id;  
default\_type text/plain;  
}  
}

–  
Ian H.  
31 Sheerwater, Northampton NN3 5HU,  
Tel: 01604 513875  
Preparing eBooks for Kindle and ePub formats to give the best reader  
experience.

---

<div class="post-metadata">

**Author:** ![dcian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dcian](https://www.ruby-forum.com/u/dcian)\
**Post date:** [October 1, 2013, 11:57pm UTC](https://www.ruby-forum.com/t/solving-a-500-error/246327/2 "2013-10-01T23:57:51Z")

</div>

On 01/10/2013 20:36, Jonathan M. wrote:

> To be fair, chap, you’re the one who has access to the log files! What  
> do_they_ say?  
> They tell me nothing new.

When I change a static file, I get a 500 error on the next static file I  
request - even if it is not the file I have changed.

Sometimes I get two consecutive 500 errors, sometimes only one.

I’m still mystified as to why I should get any at all - and why on  
unchanged files?

Regards

Ian

---

<div class="post-metadata">

**Author:** ![dcian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dcian](https://www.ruby-forum.com/u/dcian)\
**Post date:** [October 1, 2013, 9:37pm UTC](https://www.ruby-forum.com/t/solving-a-500-error/246327/3 "2013-10-01T21:37:01Z")

</div>

On 1 October 2013 17:52, Ian H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi All,
> 
> I have an nginx install with the configuration below.
> 
> The server is a linux VM running under Virtual Box on my windows machine.  
> The website / directory is made available as a sharename using Samba, which  
> I connect to from Windows, so I can edit the files. I edit in windows, using  
> familiar tools and then test using a browser, usually without restarting  
> nginx or init-fastcgi.

I used to admin some devs who had that sort of abortion of a workflow  
and did the same as you.

Just don’t do that.

> This works fine for php files. When I edit one of two javascript files, the  
> next request for a javascript file fails with a 500 error - even if the  
> request is not for the changed file.
> 
> The version of nginx I am running is 1.2.6 compiled with the long polling  
> module included.
> 
> Does anyone know what is happening?

To be fair, chap, you’re the one who has access to the log files! What  
do _they_ say?

J

---

<div class="post-metadata">

**Author:** ![dcian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dcian](https://www.ruby-forum.com/u/dcian)\
**Post date:** [October 2, 2013, 12:02am UTC](https://www.ruby-forum.com/t/solving-a-500-error/246327/4 "2013-10-02T00:02:31Z")

</div>

On Tue, 2013-10-01 at 22:57 +0100, Ian H. wrote:

> I’m still mystified as to why I should get any at all - and why on  
> unchanged files?
> 
> Regards
> 
> Ian

To reiterate what Jonathan said… you have nginx and system logs. Next  
time you get the error, how about just tailing the last 50 lines from  
all logs that have changed?

Also have you gone over the basics: disks full, out of inodes, enough  
open files, etc.

## Steve

Steve H. BSc(Hons) MIITP

> **[Linux & Admin Support Services | "Services provided by people who are proud...](https://www.greengecko.co.nz)**
>
> Offers linux support services, systems and database administration, consultancy and the full development lifecycle for open source - based solutions

Linkedin: [http://www.linkedin.com/in/steveholdoway](http://www.linkedin.com/in/steveholdoway)  
Skype: sholdowa

---

<div class="post-metadata">

**Author:** ![dcian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dcian](https://www.ruby-forum.com/u/dcian)\
**Post date:** [October 2, 2013, 12:06am UTC](https://www.ruby-forum.com/t/solving-a-500-error/246327/5 "2013-10-02T00:06:02Z")

</div>

On 1 October 2013 22:57, Ian H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On 01/10/2013 20:36, Jonathan M. wrote:
> 
> To be fair, chap, you’re the one who has access to the log files! What  
> do _they_ say?
> 
> They tell me nothing new.

You get a 500 in your _access_ log and a simultaneous entry in your  
_error_ log doesn’t appear? At all?

> When I change a static file, I get a 500 error on the next static file I  
> request - even if it is not the file I have changed.
> 
> Sometimes I get two consecutive 500 errors, sometimes only one.
> 
> I’m still mystified as to why I should get any at all - and why on unchanged  
> files?

That “push” config stuff looks like a 3rd party module. Try running  
without that enabled and see if the errors persist. If they do, try it  
without that module _compiled_ in and see if they persist.

NB I’m not suggesting you have to not use this module; just that if  
you can isolate the problem to “when it’s enabled/compiled”, then you  
can poke that module’s authors about the problem.

Cheers,  
J

---

<div class="post-metadata">

**Author:** ![dcian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dcian](https://www.ruby-forum.com/u/dcian)\
**Post date:** [October 2, 2013, 12:55pm UTC](https://www.ruby-forum.com/t/solving-a-500-error/246327/6 "2013-10-02T12:55:26Z")

</div>

Hello!

On Tue, Oct 01, 2013 at 05:52:32PM +0100, Ian H. wrote:

> This works fine for php files. When I edit one of two javascript  
> files, the next request for a javascript file fails with a 500 error
> 
> - even if the request is not for the changed file.
> 
> The version of nginx I am running is 1.2.6 compiled with the long  
> polling module included.
> 
> Does anyone know what is happening?

Key points is “Samba” and “Linux”. When you edit files via Samba  
share, it tries to lock files with fcntl(F\_GETLEASE) if running on  
Linux. This in turn results in errors while opening such “locked”  
files. For more information see Samba docs here:

[http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/locking.html#id2616903](http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/locking.html#id2616903)

It’s not clear why the problem happens with files you didn’t  
changed, but I would suppose they are at least open via Samba.

Anyway, disabling appropriate locking in Samba configuration will  
likely help. See the link above for details.

–  
Maxim D.

> **[nginx: donation](http://nginx.org/en/donation.html)**

---

<div class="post-metadata">

**Author:** ![dcian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dcian](https://www.ruby-forum.com/u/dcian)\
**Post date:** [October 2, 2013, 3:30pm UTC](https://www.ruby-forum.com/t/solving-a-500-error/246327/7 "2013-10-02T15:30:55Z")

</div>

Sounds familiar, edit files elsewhere and overwrite them for nginx’s  
destination, any basic editor has macro support, just make a macro that  
does  
a copy after save.

Posted at Nginx Forum:

> **[Re: Solving a 500 error](https://forum.nginx.org/read.php?2,243333,243371#msg-243371)**
>
> Hi All, I have an nginx install with the configuration below. The server is a linux VM running under Virtual Box on my windows machine. The website / directory is made available as a sharename using Samba, which I connect to from Windows, so I can...
