找回密码
 注册
查看: 391|回复: 0

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

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2022-10-27 15:00:22 | 显示全部楼层 |阅读模式
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
$ c8 m9 {- J& W" h& t: C
" z* o( H4 @% U, t. r. Q7 @6 enginx: the configuration file /data/nginx/conf/nginx.conf syntax is ok' ^. E' t- H9 V8 e2 R
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
$ K6 z# V( ?4 F& a4 {" K& s8 Q$ Qnginx: configuration file /data/nginx/conf/nginx.conf test failed
/ j! I# U6 z5 Q$ c- L, M1 a6 s1 x/ g1 ?1 k' k' |
$ a  D) u" X4 m! C7 S% v( \
原因:当前用户对该位置没有写入权限0 K) Q9 M! m6 m
解决办法:
. @7 U9 P8 k; S) r  `7 n1.使用命令:sudo /data/nginx/sbin/nginx -c /data/nginx/conf/nginx.conf  以root权限启动, k3 [' ]9 m  p: _$ i+ {
2.使用命令:sudo chmod -R a+rw /data/nginx 给所有用户赋权限(个人学习,不考虑安全问题); f, k! D" r/ p% K( S, M
                    /data/nginx/sbin/nginx -c /data/nginx/conf/nginx.conf  启动Nginx0 ?! d( g: j; J% y* P
9 o2 b" R( g/ i$ V# I0 v5 _
注:以非root权限启动时,会出现 nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied) 错误4 e' c6 f( i: \: p6 Z
原因:Linux只有root用户可以使用1024一下的端口" o# ^! Y$ D8 e7 Z( t4 _
解决办法:1.已root权限启动, Y6 |+ k/ @( {$ m+ u
  2.将 /data/nginx/conf/nginx.conf 文件中的80端口改为1024以上
, y2 _% `6 I: x  a; ?# Oserver {$ `- ]3 c5 ?5 t( t) X
# listen 80( e% i+ X0 A$ @. ]$ W7 I+ C
   listen 1026! O( m! P4 V- \% o) L
……% m4 S6 l6 J7 r8 n( q
}
( m2 i/ k2 I2 x0 M! I# _  E% b- P
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 05:31 , Processed in 0.024858 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表