安装基本包
yum install gcc-c++ yum install -y pcre pcre-devel yum install -y zlib zlib-devel yum install -y openssl openssl-devel
下载
wget http://nginx.org/download/nginx-1.16.0.tar.gz
解压
tar -zxvf nginx-1.16.0.tar.gz
编译 、安装
cd nginx-1.16.0 ./configure --prefix=/usr/local/nginx make && make install
启动、退出
/usr/local/nginx/sbin/nginx 启动 /usr/local/nginx/sbin/nginx -s stop 快速退出 /usr/local/nginx/sbin/nginx -s quit 优雅退出 /usr/local/nginx/sbin/nginx -s reload 变换配置,重新启动新的工作进程 /usr/local/nginx/sbin/nginx -s reopen 重新打开日志文件
注:启动完成后,在外网访问不到的情况下,必须关掉防火墙或设置防火墙
端口白名单,否则外网不能访问
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/etc/init.d/iptables save
/etc/init.d/iptables restart
nginx.conf
include gzip.conf;
upstream localhost {
ip_hash;
server localhost:8080;
server localhost:9080;
}