将nginx添加到永久环境变量/etc/profile

在/etc/profile配置文件中加入

html 复制代码
vim /etc/profile
bash 复制代码
export NGINX_HOME=/usr/local/nginx
export PATH=$PATH:$NGINX_HOME/sbin
bash 复制代码
sed -i 'aexport NGINX_HOME=/usr/local/nginx' /etc/profile
sed -i 'aPATH=$PATH:$NGINX_HOME/sbin' /etc/profile

export NGINX_HOME=安装路径

export PATH=引用安装路径变量/sbin

添加完之后一定要重新执行配置文件。

bash 复制代码
source /etc/profile
bash 复制代码
sh /etc/profile
bash 复制代码
. /etc/profile
相关推荐
only-qi3 小时前
146. LRU 缓存
java·算法·缓存
xuxie134 小时前
SpringBoot文件下载(多文件以zip形式,单文件格式不变)
java·spring boot·后端
星期天要睡觉4 小时前
Linux 综合练习
linux·运维·服务器
重生成为编程大王5 小时前
Java中的多态有什么用?
java·后端
666和7775 小时前
Struts2 工作总结
java·数据库
saynaihe5 小时前
proxmox8升级到proxmox9
linux·运维·服务器
中草药z5 小时前
【Stream API】高效简化集合处理
java·前端·javascript·stream·parallelstream·并行流
野犬寒鸦5 小时前
力扣hot100:搜索二维矩阵 II(常见误区与高效解法详解)(240)
java·数据结构·算法·leetcode·面试
zru_96025 小时前
centos 系统如何安装open jdk 8
java·linux·centos