centos7 安装配置 nginx ,nginx 配置域名及反向代理, 配置 https
安装nginx ,所需的环境,一次性可以安装完成 ,遇到选择 y 即可,本文nginx 版本是 1.8.1
yum install gcc gcc-c++ automake pcre pcre-devel zlip zlib-devel openssl openssl-devel
然后下载 nginx ,一般安装在 、usr/local 文件夹下
cd /usr/local/
wget http://nginx.org/download/nginx-1.8.1.tar.gz
如果你的服务器没有装 wget ,需要先安装 wget
yum -y install wget
然后解压安装包
tar xvf nginx-1.8.1.tar.gz
然后进入nginx目录
[root@instance-6 local]# cd nginx-1.8.1
[root@instance-6 nginx-1.8.1]# ./configure
# 如果需要配置https ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
执行安装
[root@instance-1 nginx-1.8.1]# make && make install
完成之后, usr/local 下面会有一个 nginx 的文件夹,执行启动命令 指定配置文件方式启动
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
接下来我们配置负载均衡,如图
截图的部分的意思是 当我们 通过 ip/api 方式访问这台机器上时候,会将请求平均分发到 127 和 227 两台机器上去,
有关 nginx 配置域名https 方式时,见之前的文章
还没有评论,来说两句吧...