linux安装nginx到指定目录

安装依赖

yum install gcc
yum install pcre-devel
yum install zlib zlib-devel
yum install openssl openssl-devel

//一键安装上面四个依赖

yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel

解压nginx的tar包

tar -zxvf nginx-1.12.2.tar.gz

安装nginx

cd nginx-1.12.2

./configure --prefix=/home/work/your nginx/nginx-port
make && make install

Nginx常用命令
//启动命令
安装路径下的/home/work/your nginx/nginx-port/sbin目录下:./nginx
//停止命令
安装路径下的/home/work/your nginx/nginx-port/sbin目录下:./nginx -s stop
或者 : nginx -s quit
//重启命令
安装路径下的/home/work/your nginx/nginx-port/sbin目录下:./nginx -s reload

你可能感兴趣的:(linux)