Nginx 权限问题
At my job we are moving to Nginx for the load balancing of our sites. Nginx is a very powerful load balancing/proxy server tool. It allows weighting, ssl acceleration, among other functionality while remaining light weight and easy to configure.
In preperation for a large web services launch, I began to analyze some logs and keep an eye on the system. I noticed one of the sites that we’ve already deployed was hammering our error messages in /var/log/nginx/error.log reading:
2009/06/23 12:38:22 [crit] 808#0: *724154 open() “/var/nginx/tmp/proxy_temp/4/83/0000002834″ failed (13: Permission denied) while reading upstream, client: XXX.XXX.XXX.XXX, server: xxx.host.com, request: “GET /dir/page.php”, upstream: “http://backendserverip/dir/page.php”, host: “host.com”, referrer: “http://referrer.com/apage.php”
Upon reviewing the site I noticed some (not all) of the pages were only partially loading. The issue is exactly what the log says. Permission denied = Permission issue.
Check your /etc/nginx/nginx.conf (OpenBSD) file for the user nginx processes will run as:
user nobody;
Or, do:
# ps aux | grep “nginx: worker process” | awk ‘{print $1}’ nobody
In both cases you see that I’m running the nginx worker process as user nobody. Now we need to check our permissions on: /var/nginx/tmp/proxy_temp
# ls -l /var/nginx/tmp/ | grep proxy_temp drwxrwx— 12 nobody _nginx 512 Jun 23 13:10 proxy_temp
Looks good. The directory is owned by nobody and is writeable by both nobody and the group _nginx. What could the issue be? Lets move up a level and check the permissions.
# ls -l /var/nginx | grep tmp drwx—— 5 _nginx _nginx 512 May 7 11:54 tmp
Ah ha! The parent directory is owned my _nginx:_nginx and is only writeable for that user. Our user ‘nobody’ therefore does not have the permissions to write in here. So, we can do a few things. Either make the entire directory writeable by everyone or change the ownership.
# chmod 777 /var/nginx/tmp
or
# chown nobody:_nginx /var/nginx/tmp
This should cure your permissions issues and all pages should load completely (at least mine do!)
Nginx 权限问题的更多相关文章
- nginx权限问题failed(13:Permission denied)
		
nginx权限问题failed(13:Permission denied) 环境配置 nginx Permission denied 问题: 使用nginx代理uwsgi,出现500错误,查看ngi ...
 - ubuntu 14.04中Elasticsearch 2.3 中 Nginx 权限认证
		
前言:本文实现了nginx简单保护elasticsearch,类似的保护也可以采用elasticsearch 官方插件shield 一.准备密码 1.确认htpasswd是否已经安装 which ht ...
 - 详解nginx、php-fpm和mysql用户权限
		
通常情况下,我们运行web应用的服务器有CentOS.Ubuntu.Debian等等的Linux发行版本.这时候,构成服务架构所必须的Nginx.php和MySQL等应用的权限控制就显得非常重要,各个 ...
 - tomcat用root权限也起不来
		
昨晚把服务器弄的启动不了了,先来还原一下作案现场, 错误操作过程:替换classes目录下的某个目录,比如com,由于替换了classes文件,所以需要重启tomcat,在bin目录下执行sh sta ...
 - Nginx快速入门菜鸟笔记
		
Nginx快速入门-菜鸟笔记 1.编译安装nginx 编译安装nginx 必须先安装pcre库. (1)uname -a 确定环境 Linux localhost.localdomain 2.6. ...
 - nginx网站架构优化思路(原)
		
本人接触的优化主要分为三大类 黑体的为本模块下的重点 ---------------安全优化 安全在生产场景中是第一位的 1.1 站点目录权限的优化 (修改权限755 644 所属用户root,需要 ...
 - 跨过Nginx上基于uWSGI部署Django项目的坑
		
先说说他们的关系,Nginx和uWSGI都是Web服务器,Nginx负责静态内容,uWSGI负责Python这样的动态内容,二者配合共同提供Web服务以实现提高效率和负载均衡等目的.uWSGI实现了多 ...
 - 前端页面JS和CSS以及图片加载nginx报错:net::ERR_CONTENT_LENGTH_MISMATCH的解决与检查
		
首先检查nginx权限 具体可参考地址https://www.cnblogs.com/hooly/p/9951748.html 或者百度其他方法 还有种情况,之前是可以用的,突然出现这种加载报错的情况 ...
 - Ubuntu安装设置nginx和nohup常用操作
		
nginx安装 Ubuntu直接从常规源中安装 apt-get install nginx 安装的目录 配置文件:/etc/nginx/ 主程序文件:/usr/sbin/nginx Web默认目录:/ ...
 
随机推荐
- <十一>读<<大话设计模式>>之抽象工厂模式
			
学习设计模式有一段时间了,对设计模式有一个体会,就是没那么难.就是设计程序遵循一些原则,让代码可复用,在改动的时候不用涉及太多的类,扩展方便.抽象工厂模式名字听起来抽象.但理解起来一点也不抽象,用语言 ...
 - [转载][Groovy] Groovy与Java的区别(一)
			
原文地址:[Groovy] Groovy与Java的区别(一)作者:langyizhao 因为Groovy可以用Java的所有功能(虽然JVM不同的时候可能会比较麻烦,比如在Android上),所以G ...
 - cmd下查看端口被某程序占用命令
			
经常,我们在启动应用的时候发现系统需要的端口被别的程序占用,如何知道谁占有了我们需要的端口,很多人都比较头疼,下面就介绍一种非常简单的方法,希望对大家有用 假如我们需要确定谁占用了我们的9050端口 ...
 - Linux 源代码在线(http://lxr.linux.no/linux/)。
			
LXR 是一个通用的源代码索引器和交叉引用器 它提供了一个基于 web 的可浏览任意定义以及任意标识的用法. 它支持很多种语言. LXR 曾经被作为 “Linux 交叉引用器” 但是已经被证明它可以用 ...
 - 收集一些常用Javascripot
			
获取一组单选框当前选择值: $("input[name='radGende']:checked").val();
 - ORACLE在线切换undo表空间
			
切换undo的一些步骤和基本原则 原文:http://www.xifenfei.com/3367.html 查看原undo相关参数 SHOW PARAMETER UNDO; 创建新undo空间 cre ...
 - 【转】java io 流 设计模式
			
知识点:什么是装饰模式: http://wenku.baidu.com/view/ad4eac9f51e79b896802263b.html(原理讲的很清楚) http://wenku.baidu.c ...
 - TDD 与 BDD 仅仅是语言描述上的区别么?
			
当然不是了,通过这个问题,我顺便跟大家聊聊 ATDD,TDD,BDD3者的区别,方便大家有一个清晰的认识和了解. ATDD: Acceptance Test Driven Development(验收 ...
 - python appium 有道云笔记分享文章到qq
			
有道云添加一个笔记,笔记的title为aff 使用appium 把这篇文章分享到qq,前提是android里面有登录qq Python代码 from appium import webdriver i ...
 - Mac下 如何配置虚拟机软件Parallel Desktop--超详细
			
Mac下 如何配置虚拟机软件Pparallel Desktop--超详细 Mac 的双系统解决方案有两种,一种是使用Boot Camp分区安装独立的Windows,一种是通过安装Parallels D ...