解决方法:把nginx所在的目录加入系统变量中
1.修改/etc/profile文件:vi /etc/profile 2.执行添加命令a,在PATH中添加nginx中sbin路径。
vi /etc/profile
a
PATH=$PATH:/usr/local/ngnix-1.23.1/sbin export PATH
3.执行:wq保存并退出 4.执行source /etc/profile 使配置文件生效,即可.
:wq
source /etc/profile
参考链接:https://www.cnblogs.com/ithw/p/10446930.html