项目进行nginx反向代理后发现图片和js、css等加载很慢,甚至加载不出来。

然后查看nginx的log,发现错误如下:

  1. 2016/06/30 15:31:12 [crit] 29465#0: *10 open() "/usr/local/nginx/proxy_temp/1/00/0000000001" failed (13: Permission denied) while reading upstream, client: 220.178.25.22, server: localhost, request: "GET /testpay/bootstrap/css/bootstrap.min.css HTTP/1.1", upstream: "http://12.56.6.15:5555/testpay/bootstrap/css/bootstrap.min.css", host: "90.163.226.54:90", referrer: "http://90.163.226.54:90/testpay/"
  2. 2016/06/30 15:31:12 [crit] 29465#0: *16 open() "/usr/local/nginx/proxy_temp/2/00/0000000002" failed (13: Permission denied) while reading upstream, client: 220.178.25.22, server: localhost, request: "GET /testpay/bootstrap/js/jquery.min.js HTTP/1.1", upstream: "http://12.56.6.15:7777/testpay/bootstrap/js/jquery.min.js", host: "90.163.226.54:90", referrer: "http://90.163.226.54:90/testpay/"
  3. 2016/06/30 15:31:12 [crit] 29465#0: *13 open() "/usr/local/nginx/proxy_temp/3/00/0000000003" failed (13: Permission denied) while reading upstream, client: 220.178.25.22, server: localhost, request: "GET /testpay/js/js_jquery-1.11.1.min.js HTTP/1.1", upstream: "http://12.56.6.15:7777/testpay/js/js_jquery-1.11.1.min.js", host: "90.163.226.54:90", referrer: "http://90.163.226.54:90/testpay/"
  4. 2016/06/30 15:31:13 [crit] 29465#0: *22 open() "/usr/local/nginx/proxy_temp/4/00/0000000004" failed (13: Permission denied) while reading upstream, client: 220.178.25.22, server: localhost, request: "GET /testpay/bootstrap/css/bootstrap.min.css HTTP/1.1", upstream: "http://12.56.6.15:7777/testpay/bootstrap/css/bootstrap.min.css", host: "90.163.226.54:90", referrer: "http://90.163.226.54:90/testpay/"
  5. 2016/06/30 15:31:13 [crit] 29465#0: *12 open() "/usr/local/nginx/proxy_temp/5/00/0000000005" failed (13: Permission denied) while reading upstream, client: 220.178.25.22, server: localhost, request: "GET /testpay/js/js_jquery-1.11.1.min.js HTTP/1.1", upstream: "http://12.56.6.15:7777/testpay/js/js_jquery-1.11.1.min.js", host: "90.163.226.54:90", referrer: "http://90.163.226.54:90/testpay/"
  6. 2016/06/30 15:31:13 [crit] 29465#0: *18 open() "/usr/local/nginx/proxy_temp/6/00/0000000006" failed (13: Permission denied) while reading upstream, client: 220.178.25.22, server: localhost, request: "GET /testpay/images/banner4.png HTTP/1.1", upstream: "http://12.56.6.15:5555/testpay/images/banner4.png", host: "90.163.226.54:90", referrer: "http://90.163.226.54:90/testpay/"
  7. 2016/06/30 15:31:15 [crit] 29465#0: *2 open() "/usr/local/nginx/proxy_temp/7/00/0000000007" failed (13: Permission denied) while reading upstream, client: 220.178.25.22, server: localhost, request: "GET /testpay/bootstrap/css/bootstrap.min.css HTTP/1.1", upstream: "http://12.56.6.15:5555/testpay/bootstrap/css/bootstrap.min.css", host: "90.163.226.54:90", referrer: "http://90.163.226.54:90/testpay/"
  8. 2016/06/30 15:31:15 [crit] 29465#0: *5 open() "/usr/local/nginx/proxy_temp/8/00/0000000008" failed (13: Permission denied) while reading upstream, client: 220.178.25.22, server: localhost, request: "GET /testpay/bootstrap/js/jquery.min.js HTTP/1.1", upstream: "http://12.56.6.15:7777/testpay/bootstrap/js/jquery.min.js", host: "90.163.226.54:90", referrer: "http://90.163.226.54:90/testpay/"
  9. 2016/06/30 15:31:15 [crit] 29465#0: *1 open() "/usr/local/nginx/proxy_temp/9/00/0000000009" failed (13: Permission denied) while reading upstream, client: 220.178.25.22, server: localhost, request: "GET /testpay/js/js_jquery-1.11.1.min.js HTTP/1.1", upstream: "http://12.56.6.15:7777/testpay/js/js_jquery-1.11.1.min.js", host: "90.163.226.54:90", referrer: "http://90.163.226.54:90/testpay/"

错误就是:open() "/usr/local/nginx/proxy_temp/9/00/0000000009" failed (13: Permission denied) while reading upstream

啥意思呢,意思就是说nginx没有权限访问/usr/local/nginx/proxy_temp/这个目录。

解决方案:

在nginx.conf配置文件顶部加上:

user root;

指定root用户,这样nginx就有权限访问/usr/local/nginx/proxy_temp/目录了。

nginx 配置后网站图片加载出来一半或者不出来的更多相关文章

  1. vue+webpack项目打包后背景图片加载不出来问题解决

    在做VUE +的WebPack脚手架项目打包完成后,在IIS服务器上运行发现项目中的背景图片加载不出来检查项目代码发现是因为CSS文件中,背景图片引用的路径问题;后来通过修改配置文件,问题终于解决了, ...

  2. touchweb手机网站图片加载方法(canvas加载和延迟加载)

    一.canvas图片加载 关于canvas加载,我的方法是,将文章中所有用到图片的地方,都用canvas代替,给canvas一个data-src,里面存放img的路径,通过canvas方法渲染图片.因 ...

  3. 深入探索Glide图片加载框架:做了哪些优化?如何管理生命周期?怎么做大图加载?

    前言 Glide可以说是最常用的图片加载框架了,Glide链式调用使用方便,性能上也可以满足大多数场景的使用,Glide源码与原理也是面试中的常客. 但是Glide的源码内容比较多,想要学习它的源码往 ...

  4. nginx实现动态分离,解决css和js等图片加载问题

    改帖专门为使用nginx,通过nginx把请求转发到web服务器再返回客户端的时候,解决css和js和图片加载不出来的问题. 如果没安装nginx,请访问一下地址进行安装 http://www.cnb ...

  5. Universal-Image-Loader解析(二)——DisplayImageOptions的详细配置与简单的图片加载

    在使用这个框架的时候,我们必须要配置一个DisplayImageOptions对象来作为ImageLoader.getInstance().displayImage()中的参数,所以很有必要讲解这个对 ...

  6. Fresco从配置到使用(最高效的图片加载框架)

    Frescoj说明:      facebook开源的针对android应用的图片加载框架,高效和功能齐全. 支持加载网络,本地存储和资源图片: 提供三级缓存(二级memory和一级internal ...

  7. js 图片加载完后的处理事件

    //图片加载完成后再显示页面 document.getElementById('icon').onload=function(){ document.getElementById('wrap').st ...

  8. js判断图片加载完成后获取图片实际宽高

    通常,我们会用jq的.width()/.height()方法获取图片的宽度/高度或者用js的.offsetwidth/.offsetheight方法来获取图片的宽度/高度,但这些方法在我们通过样式设置 ...

  9. JavaScript-onerror事件:图片加载失败后不显示

    HTML: <img src="http://www.mazey.net/images/upload/image/20170518/1495122198180663.gif" ...

随机推荐

  1. HDU 3537 Daizhenyang's Coin

    链接 [http://acm.hdu.edu.cn/showproblem.php?pid=3537] 题意 题意:已知一排硬币中有n个硬币正面朝上,输入正面朝上的硬币的位置ai.两人轮流操作, 每次 ...

  2. 2丶利用NABCD模型进行竞争性需求分析

    确定项目:公交查询系统 分析小组:在路上 选择比努力更重要.一个项目成功自然离不开组员们的努力.但是,光努力是不够的.还需要用户有需求,能快速实现. 这些东西,看似很虚,却能让我们少走不少弯路.做项目 ...

  3. 在XShell中使用sz和rz命令下载和上传文件

    借助XShell,使用linux命令sz可以很方便的将服务器上的文件下载到本地,使用rz命令则是把本地文件上传到服务器 工具/原料   XShell CentOS 6.5 使用sz下载文件   1 输 ...

  4. 在-for 循环里面如何利用ref 操作dom

    由于dom 元素是在渲染之后才能操作,所以如果想取到dom元素,要放到mounted()这个生命周期函数里面,并且还要用this.$nextTick(function () {})

  5. opencv学习笔记(二)

    摘要:学习资料主要参考于毛星云主编<opencv3编程入门> 1.图像显示 #include<opencv2/opencv.hpp> using namespace cv; / ...

  6. js十大排序算法:冒泡排序

    排序算法说明: (1)对于评述算法优劣术语的说明 稳定:如果a原本在b前面,而a=b,排序之后a仍然在b的前面:不稳定:如果a原本在b的前面,而a=b,排序之后a可能会出现在b的后面: 内排序:所有排 ...

  7. [转帖] IIS经典模式和集成模式的区别

    在 IIS 7.0 中,应用程序池有两种运行模式:集成模式和经典模式. https://blog.csdn.net/hongwei_23/article/details/44300923 这里面添加一 ...

  8. Linux net core docker hello world 简单使用

    安装.net core From 官网 sudo sh -c 'echo -e "[packages-microsoft-com-prod]\nname=packages-microsoft ...

  9. ThreadPoolExecutor参数

    1.ThreadPoolExecutor个参数的意义(类上的注释内容) * @param corePoolSize the number of threads to keep in the* pool ...

  10. Jquery 事件冒泡、元素的默认行为的阻止、获取事件类型、触发事件

    $(function(){// 事件冒泡 $('').bind("click",function(event){ //事件内容 //停止事件冒泡 event.stopPropaga ...