将nginx命令添加到环境变量中的方法

2021-04-08  本文已影响0人  周星星的学习笔记

一、在安装好nginx之后,直接执行nginx命令有的时候会报错找不到nginx命令。

nginx -t
报错

二、解决步骤如下:

1、编辑 ~/.bash_profile

 vim ~/.bash_profile

2、在最后PATH一行后面添加nginx实际路径配置,:wq保存

PATH=$PATH:$HOME/bin:/usr/local/openresty/nginx/sbin
export PATH

3、使配置立即生效

 source  ~/.bash_profile

4、再运行

[root@localhost sbin]# nginx -t
nginx: the configuration file /usr/local/openresty/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test is successful
上一篇 下一篇

猜你喜欢

热点阅读