|
|
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
* S0 X5 U5 D3 s+ o# }% V. _6 B; a
2 P- e! x4 {3 n. g' I, d9 e! `6 Gnginx: the configuration file /data/nginx/conf/nginx.conf syntax is ok/ i8 [- y3 U5 B& Y
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)- `3 @0 T4 z: c# ]! j; U3 R
nginx: configuration file /data/nginx/conf/nginx.conf test failed! I" H/ _2 f0 E' e" F" @
0 D# x' X7 e% i0 Y: p/ w" p
' |" y: f; {% D+ k/ U3 q原因:当前用户对该位置没有写入权限
- W( n; F$ ?* `* T解决办法:
3 n Y- C/ R1 ^/ w+ Y; Y1.使用命令:sudo /data/nginx/sbin/nginx -c /data/nginx/conf/nginx.conf 以root权限启动 B# N0 G ^ a) F D) I: o
2.使用命令:sudo chmod -R a+rw /data/nginx 给所有用户赋权限(个人学习,不考虑安全问题)
# H7 Y2 r6 C4 U- f9 e3 g /data/nginx/sbin/nginx -c /data/nginx/conf/nginx.conf 启动Nginx+ q, X! p- ~3 H& Z$ X9 s6 }' {
' N7 P& `* o2 z6 y, h# e
注:以非root权限启动时,会出现 nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied) 错误: @* {$ I& F; Q. V' Y$ ?& d0 i
原因:Linux只有root用户可以使用1024一下的端口4 O6 M" H& ]' I" ^' g
解决办法:1.已root权限启动 G: }' y4 X: N- T; P
2.将 /data/nginx/conf/nginx.conf 文件中的80端口改为1024以上
8 r- A6 B' \9 Z8 B6 W1 P1 v2 cserver {: c6 Z% h7 a4 J
# listen 80 L" D) ~# [) h6 F9 C
listen 1026& f( } O/ w$ p" J1 d
……! `' P) \/ h: N# z+ Z2 i' J
}
+ ?" i/ f; j* K# O, E& N
5 R1 T5 B1 j/ a' B/ v0 s' ~' z4 A |
|