2021-03-16

关于服务启动
普通用户要是启动nginx报错,那就是端口号低于1024
检查语法
[dky@rebot sbin 13:53:06]$ ./nginx -t
nginx: the configuration file /home/dky/robot/nginx/nginx-server/conf/nginx.conf syntax is ok
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
nginx: configuration file /home/dky/robot/nginx/nginx-server/conf/nginx.conf test failed
启动nginx
[dky@rebot sbin 13:53:19]$ ./nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
将端口号进行调整8080(大于1024即可)
报错如下:
检查语法
[dky@rebot sbin 14:00:32]$ ./nginx -t
nginx: the configuration file /home/dky/robot/nginx/nginx-server/conf/nginx.conf syntax is ok
nginx: configuration file /home/dky/robot/nginx/nginx-server/conf/nginx.conf test is successful
启动nginx
[dky@rebot sbin 14:00:47]$ ./nginx
nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)
nginx: [emerg] still could not bind()
查看端口
[dky@rebot sbin 14:00:59]$ netstat -lantup
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      8806/nginx: master
启动成功

综上所述:非root用户启动一个服务,端口号大于1024才能起来,否则premission denied .

你可能感兴趣的:(2021-03-16)