一、环境准备

时间同步

关闭防火墙

联通网络,配置yum源

软件包链接:https://pan.baidu.com/s/1qYbtpnQ

二、安装nginx

1、解决依赖关系

[root@nginx-server ~]# yum install gcc openssl-devel pcre-devel zlib-devel  -y

2、添加用户nginx,实现以之运行nginx服务进程

[root@nginx-server ~]# groupadd -r nginx
[root@nginx-server ~]# useradd -r -g nginx -s /bin/false -M nginx

3.、下载nginx软件,并编译安装

[root@nginx-server ~]# wget http://nginx.org/download/nginx-1.6.3.tar.gz
[root@nginx-server ~]# tar xf nginx-1.6..tar.gz
[root@nginx-server ~]# cd nginx-1.6.
[root@nginx-server nginx-1.6.]#./configure \
--prefix=/usr/local/nginx \
--sbin-path=/usr/local/nginx/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/tmp/nginx/client/ \
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
--http-scgi-temp-path=/var/tmp/nginx/scgi \
--with-pcre
[root@nginx-server nginx-1.6.]# make && make install

4.为nginx提供SysV init脚本

[root@nginx-server ~]# vim /etc/rc.d/init.d/nginx
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: -
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
# pidfile: /var/run/nginx.pid # Source function library.
. /etc/rc.d/init.d/functions # Source networking configuration.
. /etc/sysconfig/network # Check that networking is up.
[ "$NETWORKING" = "no" ] && exit nginx="/usr/sbin/nginx"
prog=$(basename $nginx) NGINX_CONF_FILE="/etc/nginx/nginx.conf" [ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx lockfile=/var/lock/subsys/nginx make_dirs() {
# make required directories
user=`nginx -V >& | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -`
options=`$nginx -V >& | grep 'configure arguments:'`
for opt in $options; do
if [ `echo $opt | grep '.*-temp-path'` ]; then
value=`echo $opt | cut -d "=" -f `
if [ ! -d "$value" ]; then
# echo "creating" $value
mkdir -p $value && chown -R $user $value
fi
fi
done
} start() {
[ -x $nginx ] || exit
[ -f $NGINX_CONF_FILE ] || exit
make_dirs
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq ] && touch $lockfile
return $retval
} stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq ] && rm -f $lockfile
return $retval
} restart() {
configtest || return $?
stop
sleep
start
} reload() {
configtest || return $?
echo -n $"Reloading $prog: "
killproc $nginx -HUP
RETVAL=$?
echo
} force_reload() {
restart
} configtest() {
$nginx -t -c $NGINX_CONF_FILE
} rh_status() {
status $prog
} rh_status_q() {
rh_status >/dev/null >&
} case "$1" in
start)
rh_status_q && exit
$
;;
stop)
rh_status_q || exit
$
;;
restart|configtest)
$
;;
reload)
rh_status_q || exit
$
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit
esac
而后为此脚本赋予执行权限:
[root@nginx-server ~]# chmod +x /etc/rc.d/init.d/nginx 添加至服务管理列表,并让其开机自动启动:
[root@nginx-server ~]# chkconfig --add nginx
[root@nginx-server ~]# chkconfig nginx on 而后就可以启动服务并测试了:

[root@nginx-server ~]# service nginx start
  正在启动 nginx: [确定]

[root@nginx-server ~]# netstat -tnlp|grep nginx
 tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 35524/nginx

[root@nginx-server ~]# curl -I http://192.168.0.11/
 HTTP/1.1 200 OK
 Server: nginx/1.6.3
 Date: Fri, 29 Dec 2017 13:36:19 GMT
 Content-Type: text/html
 Content-Length: 612
 Last-Modified: Fri, 29 Dec 2017 13:20:55 GMT
 Connection: keep-alive
 ETag: "5a464137-264"
 Accept-Ranges: bytes

三、安装tomcat服务器

1.安装JDK,配置Java环境

[root@tomcat-server- ~]# rpm -vih jdk-8u25-linux-x64.rpm
Preparing... ########################################### [%]
:jdk1..0_25 ########################################### [%]
Unpacking JAR files...
rt.jar...
jsse.jar...
charsets.jar...
tools.jar...
localedata.jar...
jfxrt.jar...
[root@tomcat-server ~]# cat /etc/profile.d/java.sh #设置java环境变量
export JAVA_HOME=/usr/java/latest
export CLASSPATH=$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
[root@tomcat-server- ~]# . /etc/profile.d/java.sh
[root@tomcat-server- ~]# java -version #查看java变量是否配置成功
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) -Bit Server VM (build 25.25-b02, mixed mode)

2.安装tomcat服务

[root@tomcat-server- ~]# wget http://mirrors.shuosc.org/apache/tomcat/tomcat-8/v8.0.48/bin/apache-tomcat-8.0.48.tar.gz
[root@tomcat-server- ~]# tar xf apache-tomcat-8.0..tar.gz -C /usr/local/
[root@tomcat-server- ~]# cd /usr/local/
[root@tomcat-server- local]# ln -sv apache-tomcat-8.0. tomcat
"tomcat" -> "apache-tomcat-8.0.48"
[root@tomcat-server- local]# cat /etc/profile.d/tomcat.sh #配tomcat环境变量
export CATALINA_HOME=/usr/local/tomcat
export PATH=$CATALINA_HOME/bin:$PATH
[root@tomcat-server- local]# . /etc/profile.d/tomcat.sh
[root@tomcat1-server- local]# catalina.sh start #启动服务
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/latest
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@tomcat-server- local]# netstat -tnlp #查看端口是否启动
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0.0.0.0: 0.0.0.0:* LISTEN /sshd
tcp ::: :::* LISTEN /sshd
tcp ::ffff:127.0.0.1: :::* LISTEN /java
tcp ::: :::* LISTEN /java
tcp ::: :::* LISTEN /java
[root@tomcat-server- local]# curl -I http://192.168.0.12:8080 #测试是否可以打开
HTTP/1.1 OK
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=UTF-
Transfer-Encoding: chunked
Date: Fri, Dec :: GMT 安装完成。tomcat-server-2和tomcat-server-1相同,在此忽略

 设置默认虚拟主机,并增加jvmRoute

[root@tomcat1-server- local]# vim /usr/local/tomcat/conf/server.xml
<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat-1"> #jvmRoute是jvm标识,就是页面最顶部的标签,在实际生产环境中,所有的后台tomcat标识都要一样,这里为了实验的说明性,两台tomcat的标识改成不一样的,分别为tomcat-1h和tomcat-2
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Context docBase="/Data/webapps1" path="" reloadable="true" /> #修改默认虚拟主机,并将网站文件路径指向/Data/webapps1

创建context目录和测试页面

[root@tomcat1-server- local]# mkdir -pv /Data/webapps1
mkdir: 已创建目录 "/Data"
mkdir: 已创建目录 "/Data/webapps1"
[root@tomcat1-server- local]# cat /Data/webapps1/index.jsp #创建测试页面,server-2中将tomcat-1改为tomcat-1即可
<%@ page language="java" %>
<html>
<head><title>Tomcat-</title></head>
<body>
<h1><font color="red">www.tomcat-.com</font></h1>
<table align="centre" border="">
<tr>
<td>Session ID</td>
<% session.setAttribute("tomcat-1.com","tomcat-1.com"); %>
<td><%= session.getId() %></td>
</tr>
<tr>
<td>Created on</td>
<td><%= session.getCreationTime() %></td>
</tr>
</table>
</body>
</html>

测试配置,并启动

[root@tomcat1-server- local]# catalina.sh stop
[root@tomcat1-server- local]# catalina.sh configtest
[root@tomcat1-server- local]# catalina.sh start

四、配置nginx负载均衡tomcat

[root@nginx-server ~]# vim /etc/nginx/nginx.conf
user  nginx;
worker_processes ; events {
worker_connections ;
} http {
include mime.types;
default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
sendfile on;
tcp_nopush on;
keepalive_timeout ;
gzip on;
upstream tomcat-web {
server 192.168.0.12:;
server 192.168.0.13:;
}
server {
listen ;
server_name www.tomcat.com; location / {
root html;
index index.html index.htm index.jsp;
}
location ~* \.(jsp|do)$ {
proxy_pass http://tomcat-web;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
}
location /nginx_status {
stub_status on;
access_log off;
allow 192.168.0.0/;
deny all;
}
error_page /50x.html;
location = /50x.html {
root html;
}
}
}

nginx.conf

重新载入

[root@nginx-server ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@nginx-server ~]# service nginx reload
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
重新载入 nginx: [确定]

测试(测试机配置hosts文件解析),访问http://www.tomcat.com/index.jsp URL

多刷新几次,从结果能看出,nginx把访问请求分别分发给了后端的tomcat-1和tomcat-2,客户端的访问请求实现了负载均衡,但session id不一样(即:没有实现session保持)

五、安装redis服务

下载源码,并编译

[root@redis-server ~]# wget http://download.redis.io/releases/redis-3.2.3.tar.gz
[root@redis-server ~]# tar xf redis-3.2..tar.gz
[root@redis-server ~]# cd redis-3.2.
[root@redis-server redis-3.2.]# make
[root@redis-server redis-3.2.]# make PREFIX=/usr/local/redis install

配置redis

[root@redis-server redis-3.2.]# mkdir /usr/local/redis/etc/
[root@redis-server redis-3.2.]# cp redis.conf /usr/local/redis/etc/
[root@redis-server redis-3.2.]# cd /usr/local/redis/bin/
[root@redis-server bin]# cp redis-benchmark redis-cli redis-server /usr/bin/

调整下内存分配使用方式并使其生效

#此参数可用的值为0,,
#0表示当用户空间请求更多的内存时,内核尝试估算出可用的内存
#1表示内核允许超量使用内存直到内存用完为止
#2表示整个内存地址空间不能超过swap+(vm.overcommit_ratio)%的RAM值
[root@redis-server bin]# echo "vm.overcommit_memory=1">>/etc/sysctl.conf
[root@redis-server bin]# sysctl -p

修改redis配置


[root@redis-server bin]#vim /usr/local/redis/etc/redis.conf
# 修改一下配置
#设置redis监听的地址
bind 0.0.0.0 # redis以守护进程的方式运行
# no表示不以守护进程的方式运行(会占用一个终端)
daemonize yes # 客户端闲置多长时间后断开连接,默认为0关闭此功能
timeout # 设置redis日志级别,默认级别:notice
loglevel verbose # 设置日志文件的输出方式,如果以守护进程的方式运行redis 默认:""
# 并且日志输出设置为stdout,那么日志信息就输出到/dev/null里面去了
logfile "/usr/local/redis/log/redis-access.log" #redis默认是空密码访问,这样很不安全。需要启用redis的密码验证功能
requirepass pwd@

redis环境变量配置

[root@redis-server bin]# echo "export PATH=/usr/local/redis/bin:$PATH" >  /etc/profile.d/redis.sh
[root@redis-server bin]# . /etc/profile.d/redis.sh

创建Redis 系统启动脚本

[root@redis-server bin]# cat /etc/init.d/redis
#!/bin/bash
#chkconfig:
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem. PATH=/usr/local/bin:/sbin:/usr/bin:/bin
REDISPORT=
EXEC=/usr/local/redis/bin/redis-server
REDIS_CLI=/usr/local/redis/bin/redis-cli PIDFILE=/var/run/redis_6379.pid
CONF="/usr/local/redis/etc/redis.conf" case "$1" in
start)
if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is already running or crashed"
else
echo "Starting Redis server..."
$EXEC $CONF
fi
if [ "$?"="" ]
then
echo "Redis is running..."
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
else
PID=$(cat $PIDFILE)
echo "Stopping ..."
$REDIS_CLI -p $REDISPORT SHUTDOWN
while [ -x ${PIDFILE} ]
do
echo "Waiting for Redis to shutdown ..."
sleep
done
echo "Redis stopped"
fi
;;
restart|force-reload)
${} stop
${} start
;;
*)
echo "Usage: /etc/init.d/redis {start|stop|restart|force-reload}" >&
exit
esac

redis启动脚本

[root@redis-server bin]# chmod +x /etc/init.d/redis
[root@redis-server bin]# service redis start #启动

测试:

[root@redis-server bin]# redis-cli -h 192.168.0.14 -p  -a pwd@
192.168.0.14:> keys *
(empty list or set)
192.168.0.14:> set name pwb
OK
192.168.0.14:> get name
"pwb" redis源码安装完毕

六、配置tomcatsession redis同步(tomcat-server上)

Tomcat8连接Reids需要以下3个软件包:

 commons-pool2-2.2.jar
jedis-2.5..jar
tomcat-redis-session-manager-2.0..jar #tomcat7这需要将这个包替换为tomcat-redis-session-manage-tomcat7.jar

将所需要的jar包复制到$CATALINA_HOME/lib/下,即tomcat安装目录的lib目录下

[root@tomcat-server- ~]# cp commons-pool2-2.2.jar jedis-2.5..jar tomcat-redis-session-manager-2.0..jar  /usr/local/tomcat/lib

在Tomcat的conf/context.xml文件中加入使用redis-session的配置

<Valve className="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve" />
<Manager className="com.orangefunction.tomcat.redissessions.RedisSessionManager"
host="192.168.0.14"
password="pwd@123"
port=""
database=""
maxInactiveInterval=""
/>
注意Valve必须配置在Manager之前

通过浏览器访问测试,结果如下:

可以看出,分别访问了不同的tomcat,但是得到的session却是相同的,说明达到了集群的目的。

注:从Tomcat6开始默认开启了Session持久化设置,测试时可以关闭本地Session持久化,在Tomcat的conf目录下的context.xml文件中,取消 <Manager pathname="" /> 注释即可

七、配置tomcat连接数据库

安装mysql,创建认证用户(mysql-server上)

[root@mysql-server yum]# yum install mysql-server  -y
[root@mysql-server yum]# service mysqld start
[root@mysql-server yum]# mysql
mysql> grant all on *.* to tomcat_user@'192.168.0.%' identified by '';
Query OK, rows affected (0.00 sec)

下载mysql-connector-java-5.1.22-bin.jar并复制到$CATALINA_HOME/lib目录下(tomcat-serve上)

[root@tomcat-server- ]# cd /usr/local/tomcat/
[root@tomcat-server- tomcat]#wget https://cdn.mysql.com//Downloads/Connector-J/mysql-connector-java-5.1.22.tar.gz
[root@tomcat-server- tomcat]#unzip mysql-connector-java-5.1.-bin.jar.zip
[root@tomcat-server- tomcat]#cp mysql-connector-java-5.1.-bin.jar lib/

配置JNDI数据源,保存后内容如下:

<?xml version='1.0' encoding='utf-8'?>
<!--
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- The contents of this file will be loaded for each web application -->
<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
<!--配置mysql数据库的连接池--> <!--配置mysql数据库的连接池,
需要做的额外步骤是将mysql的Java驱动类放到tomcat的lib目录下
maxIdle 连接池中最多可空闲maxIdle个连接
minIdle 连接池中最少空闲maxIdle个连接
initialSize 初始化连接数目
maxWait 连接池中连接用完时,新的请求等待时间,毫秒
username 数据库用户名
password 数据库密码
-->
<!-- Default set of monitored resources. If one of these changes, the -->
<!-- web application will be reloaded. -->
<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
--> <!-- Uncomment this to enable Comet connection tacking (provides events
on session expiration as well as webapp lifecycle) -->
<!--
<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
-->
<Valve className="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve" />
<Manager className="com.orangefunction.tomcat.redissessions.RedisSessionManager"
host="192.168.0.14"
password="pwd@123"
port=""
database=""
maxInactiveInterval=""
/>
</Context>

conf/context.xml

在项目的目录下新建WEB-INF目录,用于存放网站xml配置文件,用于tomcat连接mysql数据库

[root@tomcat-server- tomcat]mkdir /Data/webapps1/WEB-INF
[root@tomcat-server- tomcat]vim /Data/webapps1/WEB-INF/web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1"> <!-- 数据源 -->
   <resource-ref>
       <description>DB Connection</description>
       <res-ref-name>jdbc/TestDB</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
   </resource-ref>
</web-app>

WEB-INF/web.xml

重启服务

[root@tomcat1-server- WEB-INF]# catalina.sh stop
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/latest
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
[root@tomcat1-server- WEB-INF]# catalina.sh start
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/latest
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.

现在创建一个简单的测试.jsp页面,测试tomcat和mysql的连通性

[root@tomcat-server- tomcat]# vim /Data/webapps1/test.jsp
<%@page import="javax.naming.InitialContext"%>
<%@page import="javax.sql.DataSource"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
out.print("MySQL 数据源测试开始..." + "<br/>");
DataSource ds = null;
try {
InitialContext ctx = new InitialContext();
ds = (DataSource) ctx.lookup("java:comp/env/jdbc/TestDB");
Connection conn = ds.getConnection();
conn.close();
out.print("MySQL 数据源测试成功!");
} catch (Exception ex) {
out.print("出现意外,信息是:" + ex.getMessage());
ex.printStackTrace();
}
%>
%</body>
%</html>

test.jsp

访问测试页:

 以看出来,现在tomcat可以连接到数据库了。

Tomcat+Nginx+Redis+MySQL实现反向代理、负载均衡、session共享的更多相关文章

  1. 【05】Nginx:TCP / 正向 / 反向代理 / 负载均衡

    写在前面的话 在我们日常的工作中,不可能所有的服务都是简单的 HTML 静态网页,nginx 作为轻量级的 WEB 服务器,其实我们将它用于更多的地方还是作为我们网站的入口.不管你是后端接口,还是前端 ...

  2. nginx之rewrite重写,反向代理,负载均衡

    rewrite重写(伪静态): 在地址栏输入xx.com/user-xxx.html, 实际上访问的就是xxx.com/user.php?id=xxx rewrite就这么简单 附上ecshop re ...

  3. 反向代理/负载均衡/session/cookie

    正向代理:客户端将流量重定向到burpsuite等软件或连接到VPN再访问服务器而不是直接访问服务器的场景.流量流动方向是真正机器--代理服务器.正向代理又称代理.普通代理. 反向代理:服务器端使用反 ...

  4. 如何使用Weave以及Docker搭建Nginx反向代理/负载均衡服务器

    Hi, 今天我们将会学习如何使用 Weave 和 Docker 搭建 Nginx 的反向代理/负载均衡服务器.Weave 可以创建一个虚拟网络将 Docker 容器彼此连接在一起,支持跨主机部署及自动 ...

  5. Nginx 反向代理 负载均衡 虚拟主机配置

    Nginx 反向代理 负载均衡 虚拟主机配置 通过本章你将学会利用Nginx配置多台虚拟主机,清楚代理服务器的作用,区分正向代理和反向代理的区别,搭建使用Nginx反向搭理和负载均衡,了解Nginx常 ...

  6. Nginx 反向代理 负载均衡 虚拟主机

    Nginx 反向代理 负载均衡 虚拟主机配置 通过本章你将学会利用Nginx配置多台虚拟主机,清楚代理服务器的作用,区分正向代理和反向代理的区别,搭建使用Nginx反向搭理和负载均衡,了解Nginx常 ...

  7. 十.nginx反向代理负载均衡服务实践部署

    期中集群架构-第十章-nginx反向代理负载均衡章节章节====================================================================== 0 ...

  8. 【转】Nginx 反向代理 负载均衡 虚拟主机配置

    原文:http://www.cnblogs.com/itdragon/p/8059000.html Nginx 反向代理 负载均衡 虚拟主机配置 通过本章你将学会利用Nginx配置多台虚拟主机,清楚代 ...

  9. 项目实战2.2—nginx 反向代理负载均衡、动静分离和缓存的实现

    实验一:实现反向代理负载均衡且动静分离 1.环境准备: 机器名称 IP配置 服务角色 备注 nginx VIP:172.17.11.11 反向代理服务器 开启代理功能 设置监控,调度 rs01 RIP ...

随机推荐

  1. Js时间格式[转载]

    var myDate = new Date();myDate.getYear();        //获取当前年份(2位)myDate.getFullYear();    //获取完整的年份(4位,1 ...

  2. Visual Studio中设置Nuget程序包源

    用vs2015,默认的程序包源是Microsoft and .NET,很多常见的开源包在里面搜索不到. 这时候就需要配置一个更开放的包源,网上搜了一下,都没人提供这个问题,所以自己动脑花了一番脑经,看 ...

  3. msp430及stm32中基本的C编程知识

    为什么我使用P1OUT ^= 0x01;和P1OUT = 0x01 ^是异或计算符号 所以 每次运算都是反转的.而不不加这个运算符就是一直保持1的状态. p1out|=bit6的意思p1out的值如果 ...

  4. android利用provider查询同一个数据库中没有对外暴露出来的表

    [原创]转载请加本篇博客地址http://www.cnblogs.com/scarecrow-blog/p/6266042.html 个人感觉这是android provider 的一个漏洞, 废话少 ...

  5. HTTP协议之chunk介绍

    http chunked 当客户端向服务器请求一个静态页面或者一张图片时,服务器可以很清楚的知道内容大小,然后通过Content-Length消息首部字段告诉客户端需要接收多少数据.但是如果是动态页面 ...

  6. 跟着未名学 - 录屏套件 Camtasia Studio

    目录 Camtasia Recorder. 1 Camtasia Studio.. 2 时间线... 2 渲染... 5 Camtasia MenuMaker. 6 Camtasia Play. 6 ...

  7. Java ArrayList排序方法详解

    由于其功能性和灵活性,ArrayList是 Java 集合框架中使用最为普遍的集合类之一.ArrayList 是一种 List 实现,它的内部用一个动态数组来存储元素,因此 ArrayList 能够在 ...

  8. tomcat源码 StandardService

    在执行StandardServer的initInternal的时候会执行StandardService#init,然后会调到initInternal protected void startInter ...

  9. vi 编辑器基本命令

    命令模式(esc) k 上移一行j 下移一行h 左移一行l 右移一行 6j  下移6行 5k 上移5行 0 将游标放在一行的开始$ 将游标放在一行的末尾w 将游标移动到下一个单词b 将游标移动到上一个 ...

  10. 【问题解决】docker中创建volume时,无访问权限

    挂载宿主机已存在目录后,在容器内对其进行操作,报"Permission denied". 可通过两种方式解决: 1> 关闭selinux. 临时关闭:# setenforce ...