nginx在更改时提供错误的js文件
nginx serves wrong the js files on change
我有一个虚拟机(用puPHPet和流浪者构建)。当我更改.js文件时,Web服务器会错误地为其提供服务。
这是我的js文件的结尾:
$(document).ready(function () {
// $('.chat-menu-toggle').sidr({
// name: 'sidr',
// side: 'right',
// onOpen: function () {
// PslConversation.sidebarOpen = true;
// },
// onClose: function () {
// PslConversation.sidebarOpen = false;
// }
// });
PslConversation.init();
window.PslConversation = PslConversation;
});
});
当在文件中的任何位置添加3个字符时,浏览器将在文件的末尾显示以下内容:
��
我用十六进制检查了一下。
EF BF BD EF BF BD
如果我删除文件中的任何位置,它将从浏览器中的文件末尾删除。我尝试了不同的浏览器,结果一直都是一样的。
我将nginx与php-fpm结合使用。如果我重新启动nginx,没有什么变化,但当我更改php文件时,没有问题,只有在js和css中。
据我所知,我没有任何缓存。
我的nginx配置:
server {
listen 192.168.56.102:80;
keepalive_timeout 70;
listen 80;
set $host_path "/var/www/html";
server_name frontend.psl;
root $host_path/frontend/web;
set $yii_bootstrap "index.php";
charset utf-8;
location / {
index index.html $yii_bootstrap;
try_files $uri $uri/ /$yii_bootstrap?$args;
add_header Access-Control-Allow-Origin *;
}
location ~ '.php {
fastcgi_split_path_info ^(.+'.php)(.*)$;
#let yii catch the calls to unexising PHP files
set $fsn /$yii_bootstrap;
if (-f $document_root$fastcgi_script_name){
set $fsn $fastcgi_script_name;
}
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fsn;
fastcgi_read_timeout 150;
#PATH_INFO and PATH_TRANSLATED can be omitted, but RFC 3875 specifies them for CGI
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fsn;
}
location ~ /'. {
deny all;
access_log off;
log_not_found off;
}
}
请帮助查找问题。
我遇到了同样的问题。。。
在nginx配置文件的末尾添加这行sendfile off;
应该可以修复
像
server {
... ... ...
... ... ...
location / {
... ... ...
... ... ...
}
location ~ '.php$ {
... ... ...
... ... ...
}
sendfile off;
}
相关文章:
- Node.js v6.2.0类扩展不是函数错误
- 同样,同样的错误'ahorcado.js:26未捕获类型错误:无法读取属性'beginPath'
- RxJS:在循环中处理错误.js自定义驱动程序
- 如何在快递中抛出 404 错误.js
- 如何捕获服务器错误 JS
- 帆的“500”错误.js“测试项目”
- 快递中的会话未定义错误.js
- jquery.validate 中的错误.js“javaScript 运行时错误:无法获取未定义或空引用的属性'
- 角度动画中的奇怪错误.js
- 如何删除“对象在节点中没有方法'forEach'错误.js”
- 错误 JS 将发布数据发送到控制器 -CodeIgniter
- 使用摩卡在节点上测试错误.js函数
- 为什么 Magento js/varien/form.js IE 中的错误 - js fiddle
- 检测导致冻结等问题的错误 JS
- 三中的错误.js:相机不是三的实例.照相机
- 编译错误js.72.未处理的错误
- PHP停止表单重新加载显示错误Js
- 节点中的套接字挂断错误.js使用 https 时
- 纹理加载错误(JS动画)
- jasmineNodeOpts:执行量角器时出现意外的标识符错误.js