修改后,nginx总是给JS文件500个错误

我在本地的CentOS 6.3服务器上运行nginx。 我有一个特定的JavaScript文件加载在网页中。 如果我更改JavaScript文件,并刷新网页,我总是得到一个500错误。 然后当我再次刷新,JS文件加载得很好。

后来,如果我再次更改JS文件,并刷新浏览器,相同的500错误。 刷新第二次,它加载得很好。 它只给第一次刷新500错误。

为什么是这样? 这是我的服务器configuration:

server { listen 80; server_name www.mysite.local; rewrite ^(.*) http://mysite.local$1 permanent; } server { listen 80; server_name mysite.local; access_log /var/log/nginx/mysite.local/access.log; error_log /var/log/nginx/mysite.local/error.log; rewrite_log on; root /vhosts/mysite/mysite.local/public; index index.php; # Heres my redirect, try normal URI and then our Laravel urls. location / { try_files $uri $uri/ /index.php?$query_string; } include /etc/nginx/templates/other; 

这里是包含文件:

 if (!-d $request_filename) { rewrite ^/(.+)/$ /$1 permanent; } location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } location ~ /\.ht { deny all; } 

错误日志:

 2014/09/06 23:19:58 [crit] 27884#0: *29935 open() "/vhosts/mysite.local/public/js/testfile.js" failed (11: Resource temporarily unavailable), client: 192.168.1.51, server: mysite.local, request: "GET /js/testfile.js HTTP/1.1", host: "mysite.local", referrer: "http://mysite.local/some/page" 

我是唯一连接到服务器的人。 没有其他的交通。 如果在保存文件后立即刷新页面,或等待(如15秒钟),则无关紧要。 第一次刷新总是500错误。

我通过Samba连接访问/编辑文件。

这最终成为Samba的一个问题,而不是nginx。 我通过将以下内容添加到我的Sambaconfiguration中来解决问题:

 oplocks = no level2 oplocks = no 

最初发现在以下SO线程: https : //stackoverflow.com/questions/10202567/nginx-resource-temporarily-unavailable-using-a-samba-share