首先搭建tomcat服务不再叙述,规划好每台机器的ip,确保能访问,同事也要留好标记到时候出问题的时候可以快速确定是哪台机器有问题
然后下载Nginx
[root@localhost sbin]# tar xvf nginx-1.14.2.tar.gz -C /usr/local/
[root@localhost sbin]# mv /usr/local/nginx-1.14.2/ /usr/local/nginx/
下载完成后进入Nginx目录,执行./configure报错
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
看来需要下载PCRE包
执行以下命令即可
yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel
再次执行./configure没报错,再执行make install 时报错
cp: `conf/koi-win' and `/usr/local/nginx/conf/koi-win' are the same file
于是重新执行
./configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/nginx.conf
再执行make install就可以了
接下来到conf目录下修改配置nginx.conf文件
主要就是这几个配置
再次访问这个服务器的80端口,发现已经可以转发请求到相应四台机器上了
至此配置完毕
转载于:https://blog.51cto.com/969346/2372770