linux安装nginx到指定目录-九五小庞
1.Nginx下载
![](https://img2020.cnblogs.com/blog/1943666/202102/1943666-20210223102558227-1102960755.png)
2.安装依赖
yum install gcc
yum install pcre-devel
yum install zlib zlib-devel
yum install openssl openssl-devel
//一键安装上面四个依赖
yum install -y gcc pcre pcre-devel openssl openssl-devel gd gd-devel
3.解压nginx的tar包
tar -zxvf nginx-1.19.7.tar.gz
4.安装nginx
cd nginx-1.19.7
./configure --prefix=/home/work/your
make
make install
Nginx常用命令
//启动命令
安装路径下的/home/work/your/sbin
目录下:./nginx
//停止命令
安装路径下的/home/work/your nginx/sbin
目录下:./nginx -s stop
或者 : nginx -s quit
//重启命令
安装路径下的/home/work/your nginx/sbin
目录下:./nginx -s reload