1.源码编译方式:
1.安装 make:yum -y install autoconf automake make
2.安装 g++: yum -y install gcc gcc-c++
#一般系统中已经装了了 make 和 g++,无须再装
3.yum -y install pcre pcre-devel
4.yum -y install zlib zlib-devel
5.yum install -y openssl openssl-devel
#安装 nginx 依赖的库
6.wget http://nginx.org/download/nginx-1.15.8.tar.gz
7.tar -zxvf nginx-1.15.8.tar.gz cd nginx-1.15.8
8../configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
#配置 #--prefix 指定安装目录
#--with-http_ssl_module 安装 https 模块
#creating objs/Makefile 代表编译成功
9.make && make install
#make 编译
#make install 安装
2、yum 方式:
1.yum install yum-utils
2.yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
3.yum install openresty
3.Nginx 常用命令
启停命令:
1. ./nginx -c nginx.conf 的文件。如果不指定,默认为 NGINX_HOME/conf/nginx.conf
2. ./nginx -s stop 停止
3. ./nginx -s quit 退出
4. ./nginx -s reload 重新加载 nginx.conf