项目进行nginx反向代理后发现图片和js、css等加载很慢,甚至加载不出来。
然后查看nginx的log,发现错误如下:
- 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/"
- 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/"
- 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/"
- 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/"
- 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/"
- 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/"
- 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/"
- 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/"
- 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 配置后网站图片加载出来一半或者不出来 - Python技术站