AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 626789
Accepted
Jake Wilson
Jake Wilson
Asked: 2014-09-07 20:55:41 +0800 CST2014-09-07 20:55:41 +0800 CST 2014-09-07 20:55:41 +0800 CST

在我更改它后,nginx 总是为 JS 文件提供 500 错误

  • 772

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

稍后,如果我再次更改 JS 文件,并刷新浏览器,同样的 500 错误。一次又一次地刷新,它加载得很好。它只在第一次刷新时给出 500 错误。

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

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 连接访问/编辑文件。

linux
  • 1 1 个回答
  • 753 Views

1 个回答

  • Voted
  1. Best Answer
    Jake Wilson
    2014-09-09T08:51:17+08:002014-09-09T08:51:17+08:00

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

    oplocks = no
    level2 oplocks = no
    

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

    • 2

相关问题

  • Linux 主机到主机迁移

  • 如何在 Linux 机器上找到有关硬件的详细信息?

  • 如何在 Linux 下监控每个进程的网络 I/O 使用情况?

  • 在 RHEL4 上修改 CUPS 中的现有打印机设置

  • 为本地网络中的名称解析添加自定义 dns 条目

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve