[root@hadoop1 /]# nginx -t
bash: nginx: 未找到命令...
1、查看nginx安装目录
输入命令
# ps -ef | grep nginx
返回结果包含安装目录
root 2662 1 0 07:12 ? 00:00:00 nginx: master process /usr/sbin/nginx
2、查看nginx.conf配置文件目录
输入命令
# nginx -t 返回结果包含配置文件目录
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
1.编辑环境变量
vim /etc/profile
2.把nginx添加上去
89
90
91 PATH=$PATH:/usr/local/nginx/sbin
92 export PATH
注意: 一定要注意 /usr/local/nginx/sbin 地址 (安装地 址,非安装包地址)
3. 重新加载环境,解决
source /etc/profile
4 验证是否成功
[root@hadoop1 /]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
5
nginx热启动命令
nginx -s reload