nginx 读取文件 permission denied
nginx 是在root用户下安装的,静态网页的目录/var/www/html/ 目录下的内容所有者也是root 用户,按照 nginx配置文件中location说明 配置静态文件访问地址。
使用网址访问后出现错误日志显示如下
root@localhost:/etc/nginx# more /var/log/nginx/error.log
// :: [error] #: * open() "/var/www/html/show/project/test1.html" failed (: Permission denied), client: 101.228.94.31, server: _, request: "GET
/show/project/test1.html HTTP/1.1", host: "45.78.33.187"
// :: [error] #: * open() "/var/www/html/show/project/test1.html" failed (: Permission denied), client: 101.228.94.31, server: _, request: "GET
/show/project/test1.html HTTP/1.1", host: "45.78.33.187"
// :: [error] #: * open() "/var/www/html/show/project/test1.html" failed (: Permission denied), client: 101.228.94.31, server: _, request: "GET
/show/project/test1.html HTTP/1.1", host: "45.78.33.187"
// :: [error] #: * open() "/var/www/html/show/project/test1.html" failed (: Permission denied), client: 101.228.94.31, server: _, request: "GET
/show/project/test1.html HTTP/1.1", host: "45.78.33.187"
// :: [error] #: * directory index of "/var/www/html/show/project/" is forbidden, client: 101.228.94.31, server: _, request: "GET /show/project/ H
TTP/1.1", host: "45.78.33.187"
// :: [error] #: * directory index of "/var/www/html/show/project/" is forbidden, client: 101.228.94.31, server: _, request: "GET /show/project/ H
TTP/1.1", host: "45.78.33.187"
// :: [error] #: * open() "/var/www/html/show/project/test1.html" failed (: Permission denied), client: 101.228.94.31, server: _, request: "GET
/show/project/test1.html HTTP/1.1", host: "45.78.33.187"
// :: [error] #: * open() "/var/www/html/show/project/test1.html" failed (: Permission denied), client: 101.228.94.31, server: _, request: "GET
/show/project/test1.html HTTP/1.1", host: "45.78.33.187"
// :: [emerg] #: invalid number of arguments in "root" directive in /etc/nginx/sites-enabled/default:
// :: [notice] #: signal process started
// :: [error] #: * open() "/var/www/html/show/project/test1.html" failed (: Permission denied), client: 101.228.94.31, server: _, request: "GET
/show/project/test1.html HTTP/1.1", host: "45.78.33.187"
// :: [error] #: * open() "/var/www/html/show/project/test1.html" failed (: Permission denied), client: 101.228.94.31, server: _, request: "GET
/show/project/test1.html HTTP/1.1", host: "45.78.33.187"
修改配置文件的 user 配置,改为 root,默认位置是 /etc/nginx/nginx.cnf。

修改好后重启nginx,使用命令如下
nginx -s reload
重新访问页面正常了。
nginx 读取文件 permission denied的更多相关文章
- nginx 出现 13: Permission denied
原文地址:http://www.nginx.cn/695.html 前段时间把程序员的wordpress升级到3.5.1,本身如果没有特别的插件,在后台更新就能完成. 更新完成后在后台发布文章,编辑器 ...
- Hadoop:hdfs文件permission denied问题解析
Cron jobs can be scheduled, but fail to write parquet file and seems due to user permission of “yarn ...
- 解决Nginx的13: Permission denied) while connecting to upstream
一.问题 做Nginx负载的时候,经常遇到这样的情况: // :: [crit] #: * connect() to failed (: Permission denied) while connec ...
- ubunt 文件permission denied问题的解决
在linux系统使用过程中,升级python到3.6以后,执行pip命令,遇到permission denied问题,系统显示如下: -bash: /home/www/my_flask/venv/bi ...
- Linux执行.sh文件Permission denied
执行sh文件报没有权限: 看下该文件的权限: 缺少执行的权限,直接加上吧: test.sh 权限加上去了,可以执行sh文件了 若用 chmod 4755 filename 可使此程序具有root的权限
- mac linux 创建文件 Permission denied
解决方法: $ sudo chmod -R 777 目录其中-R 是指级联应用到目录里的所有子目录和文件777 是所有用户都拥有最高权限
- nginx 请求文件 进行用户认证/鉴权: internal(限制为内部调用)
在进行WEB开发时, 必然会遇到向用户返回文件的场景(如图片, 文档等等), 当返回的文件较小时, 我们可以直接通过接口以数据流的形式向前台返回, 因为文件较小, 因此也不会太过于影响响应速度及服务器 ...
- nginx执行文件替换掉之后重启提示permission denied
重启的时候显示 -bash: /usr/local/nginx/sbin/nginx: Permission denied 进入nginx执行文件的目录:
- Nginx报错403 forbidden (13: Permission denied)的解决办法
由于开发需要,在本地环境中配置了LNMP环境,使用的是Centos 6.5 的yum安装,安装一切正常,但是由于默认网站文件夹比较奇葩,于是把网站文件用mv命令移动到了新的目录,并相应修改了配置文件, ...
随机推荐
- JERSEY中文翻译(第一章、Getting Started、2.2)
前言 这是jersey2.2的用户向导,我们会尽力维护它的更新并且也会增加新的章节.当阅读本用户指南的时候,也要参阅Jersey API 文档,额外的信息补充JERSEY的新特性和API 如果你想要为 ...
- 转:nginx基础概念(connection)
在nginx中connection就是对tcp连接的封装,其中包括连接的socket,读事件,写事件.利用nginx封装的connection,我们可以很方便的使用nginx来处理与连接相关的事情,比 ...
- Spark GraphX实例(1)
Spark GraphX是一个分布式的图处理框架.社交网络中,用户与用户之间会存在错综复杂的联系,如微信.QQ.微博的用户之间的好友.关注等关系,构成了一张巨大的图,单机无法处理,只能使用分布式图处理 ...
- vue 去掉元素之间空格 preserveWhitespace
preserveWhitespace 说明参考:https://vue-loader.vuejs.org/zh/options.html#compiler options: { compilerOpt ...
- Python学习摘录(下)
常用内建模块 1:collections模块:集合模块,提供了许多有用的集合类. namedtuple namedtuple是一个函数,它用来创建一个自定义的tuple对象,并且规定了tuple元素的 ...
- JavaWeb分页显示内容之分页查询的三种思路(数据库分页查询)
转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/6134851.html 在开发过程中,经常做的一件事,也是最基本的事,就是从数据库中查询数据,然后在客户端显示出 ...
- VTK中获取STL模型点的坐标以及对其进行变换
VTK是一个基于面向对象的开源三维绘图软件包,和其它的的三维绘图引擎如OSG.OGRE不同之处在于,VTK可视化对象主要是各种数据,更加注重对数据分析处理后的可视化,可视化的内容是人们无法直接感受到的 ...
- excel如何快速实现数据区域的框选
这里会存在2个情况,一个是快速的选择一行或者一列的数据,另外一个是快速的选择一块的数据(数据区域) 1.当有上万条数据时,怎么快速的选择一行或一列的数据? 方法:将鼠标放在需要选择的数据区域的开头位置 ...
- OPML文件
# -*- coding: cp936 -*-#python 27#xiaodeng#OPML文件 #大纲处理标记语言其实建立在颗脱战标记语言之上的标记语言#也叫文件扩展名#是建立在XML之上的一种文 ...
- Linux针对缺少响应xxx.so.xxx解决方案
问题描述: 在yum安装,偶尔会出现缺少xxx.so.0 xxxx.so.1等类似问价,大部分都是缺失对应的库文件 --> Processing .5p1-.fc27.x86 _64--> ...