CentOS快速安装Nginx的方法,nginx如何启动重启停止

1、防止 make: command not found,提前安装一些插件,取决于当前环境是否已安装,如果已经安装就不需要执行此命令

yum -y install gcc automake autoconf libtool make

防止 make: command not found

2、下载源码进行安装

wget http://nginx.org/download/nginx-1.18.0.tar.gz

3、安装需要的插件

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

4、解压压缩包

tar -zxvf nginx-1.18.0.tar.gz

5、指定安装路径

./configure --prefix=/root/nginx/nginx-1.18.0

6、编译并安装

make && make install

7、启动服务(进入到安装目录的sbin)

 ./nginx

8、重启服务(进入到安装目录的sbin)

./nginx -s reload         

9、停止服务(进入到安装目录的sbin)

./nginx -s stop  或者 ./nginx -s quit
posted @ 2020-06-19 16:49  Mr.Tony  阅读(2171)  评论(0编辑  收藏  举报