nginx 重新部署,使用了新的用戶時出現了權限異常

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  

發佈了15 篇原創文章 · 獲贊 6 · 訪問量 2869
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章