解决

server {
listen [::]:80 default_server; # SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf; #root /var/www/html; # Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html; server_name _; location / {
# First attempt to serve request as file, then
root /root/test/dist;
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.html;
} ……
}

首先确定将 root 指定的目录权限改为 775

chmod -R 775 /root/test/dist;

然后将 nginx.conf 文件的 user 设置为 root

如果你想用默认的 www-data 用户,需要将 www-data 添加到 username 组中:

gpasswd -a www-data username

确保 username 组可以沿着路径输入所有目录:

chmod g+x /root && chmod g+x /root/test/dist

运行 stat 看看是否成功:

sudo -u www-data stat /root/test/dist

检查 nginx 配置

nginx -t

重启 nginx

nginx -s reload

Nginx: stat() failed (13: permission denied)的更多相关文章

  1. nginx: [emerg] open() "/var/run/nginx.pid" failed (13: Permission denied)

    现象 1.centos6.9 用rpm包安装nginx 2.修改Nginx的多个配置文件和配置项 3.service nginx restart 报错: nginx: [emerg] open() & ...

  2. Ubuntu nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)

    在Ubuntu 12中启动刚安装好的Nginx,报错: nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied) 原因如下: ...

  3. 解决Nginx的connect() to 127.0.0.1:8080 failed (13: Permission denied) while connect

    在进行Nginx+Tomcat 负载均衡的时候遇到了这个权限问题,在error.log日志中.我们能够看到例如以下: connect() to 127.0.0.1:8080 failed (13: P ...

  4. nginx权限问题failed(13:Permission denied)

    nginx权限问题failed(13:Permission denied) 环境配置  nginx Permission denied 问题: 使用nginx代理uwsgi,出现500错误,查看ngi ...

  5. 解决Mac nginx问题 [emerg] 54933#0: bind() to 0.0.0.0:80 failed (13: Permission denied)

    brew services restart nginx Stopping nginx... (might take a while) ==> Successfully stopped nginx ...

  6. 解决nginx访问问题connect() to 127.0.0.1:8080 failed (13: Permission denied) while connecting to upstream,

    问题:搭建好项目之后,用nginx进行代理,进行日常配置之后,发现前端正常访问,但是后端访问出现错误,报502错误,查找nginx日志,发现connect() to 127.0.0.1:8080 fa ...

  7. Starting nginx: nginx: [emerg] bind() to 0.0.0.0:8088 failed (13: Permission denied) nginx 启动失败

     Starting nginx: nginx: [emerg] bind() to 0.0.0.0:8088 failed (13: Permission denied)     nginx 启动失败 ...

  8. nginx bind() to 0.0.0.0:**** failed (13: Permission denied)

    nginx 启动失败,日志里面报错信息如下: Starting nginx: nginx: [emerg] bind() to 0.0.0.0:**** failed (13: Permission ...

  9. php fpm安装curl后,nginx出现connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied)的错误

    这里选择直接apt-get安装,因为比起自己编译简单多了,不需要自己配置什么 #sudo apt-get install curl libcurl3 libcurl3-dev php5-curl 安装 ...

  10. nginx 502错 failed (13: Permission denied)

    安装nginx和php-fpm之后出现502错误 找了个理由说php-fpm不启动 ,但在我的实践中,该过程开始 找了半天没找到病因.视图nginx记录后 我发现下面的错误 [crit] 2686#0 ...

随机推荐

  1. shell(希尔)排序------python实现

    if __name__ == '__main__': ''' 希尔排序 1.选择一个增量序列t1,t2,...,tk,其中ti>tj,tk=1 2.按增量序列个数K,对序列进行K躺排序 3.每趟 ...

  2. Qt Creator 5.0 发布

    我们很高兴地宣布 Qt Creator 5.0 的发布! 正如4.15 发布博文中所宣布的,我们将切换到语义版本控制方案,因此这是 Qt Creator 很长一段时间以来的第一次主要版本更新!不过不要 ...

  3. sql建表添加注释的语句

    官方自带的,我觉得麻烦,稍微'封装'一下 create proc Proc_AddExplian @table varchar(200), @clolum varchar(200), @text va ...

  4. Verilog3_组合逻辑电路

    组合逻辑电路设计方法 使用assign语句: 描述简单的组合逻辑电路 使用always块: 描述复杂的组合逻辑电路 要点: 只在一个always模块中对某一变量进行赋值: 将所有敏感变量列在敏感变量列 ...

  5. Linux安全加固(一)

    1.Linux关键用户文件/etc/password文件 Root:x:0:0:root:/bin/bash ●用户名:代表用户账号的字符串.通常长度不超过8个字符,并且由大小写字母和/或数字组成.登 ...

  6. 6种微服务RPC框架-copy

    一类是跟某种特定语言平台绑定的,另一类是与语言无关即跨语言平台的. 跟语言平台绑定的开源 RPC 框架主要有下面几种. Dubbo:国内最早开源的 RPC 框架,由阿里巴巴公司开发并于 2011 年末 ...

  7. 简单了解RPC实现原理-copy

    核心框架类 /* * Copyright 2011 Alibaba.com All right reserved. This software is the * confidential and pr ...

  8. 第三章 dubbo源码解析目录

    7.6 服务远程暴露 - 注册服务到zookeeper 为了安全:服务启动的ip全部使用10.10.10.10 远程服务的暴露总体步骤: 将ref封装为invoker 将invoker转换为expor ...

  9. 项目PMP之六项目进度管理

    项目PMP之六--项目进度管理   一.定义:用于沟通和管理相关方期望的工具,可作为报告绩效的基础,说明项目的交付时间和方式 迭代型进度计划(敏捷模式):接受存在未完成项,滚动式规划管理 按需进度计划 ...

  10. springBoot(1)--初步理解

    在没有用SpringBoot之前,我们用spring和springMVC框架,但是你要做很多比如: (1)配置web.xml,加载spring和spring mvc 2)配置数据库连接.配置sprin ...