nginx 重新部署,使用了新的用户时出现了权限异常
之前已经通过一个用户ROOT进行部署了nginx,之后发现切换用户之后无法启动。出现了nginx默认相关配置异常的情况。
[sjzl@localhost nginx]$ ./nginx -c /home/sjzl/sjzl4.1/tongyongbanbase/soft/nginx/conf/nginx.conf
nginx: [alert] could not open error log file: open() "/root/sjzl4.1/tongyongbanbase/soft/nginx/logs/error.log" failed (13: Permission denied)
2019/12/09 11:22:17 [emerg] 15968#0: mkdir() "/root/sjzl4.1/tongyongbanbase/soft/nginx/client_body_temp" failed (13: Permission denied)
执行的时候指定了配置文件的路径,还是报错 :/home/sjzl/sjzl4.1/tongyongbanbase/soft/nginx/nginx -c /home/sjzl/sjzl4.1/tongyongbanbase/soft/nginx/conf/nginx.conf
后面查询nginx默认配置指令
[sjzl@localhost nginx]$ ./nginx -h
nginx version: nginx/1.10.1
Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives]
Options:
-?,-h : this help
-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
-T : test configuration, dump it and exit
-q : suppress non-error messages during configuration testing
-s signal : send signal to a master process: stop, quit, reopen, reload
-p prefix : set prefix path (default: /root/sjzl4.1/tongyongbanbase/soft/nginx/)
-c filename : set configuration file (default: conf/nginx.conf)
-g directives : set global directives out of configuration file
发现-p的路径由于之前已经启动过,进行了默认的环境配置指令。
[sjzl@localhost nginx]$ ./nginx -p /home/sjzl/sjzl4.1/tongyongbanbase/soft/nginx -c /home/sjzl/sjzl4.1/tongyongbanbase/soft/nginx/conf/nginx.conf
重新指定路径后。能够正常启动了。
[sjzl@localhost nginx]$ ./nginx -p /home/sjzl/sjzl4.1/tongyongbanbase/soft/nginx -c /home/sjzl/sjzl4.1/tongyongbanbase/soft/nginx/conf/nginx.conf
[sjzl@localhost nginx]$ netstat -anp | grep nginx
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 16004/nginx: master
unix 3 [ ] STREAM CONNECTED 90303 16004/nginx: master
unix 3 [ ] STREAM CONNECTED 90304 16004/nginx: master