# 1. Docker安装
# 1.1 卸载历史版本
/* 查看历史安装包 */
yum list installed | grep docker
/* 删除历史安装包 - 将上述命令列出的相关包全部删除 */
yum -y remove xxx
2
3
4
5
6
// 删除历史目录或文件
rm -rf /etc/systemd/system/docker.service.d
rm -rf /var/lib/docker
rm -rf /var/run/docker
2
3
4
5
6
7
# 1.2 在线安装
- 安装依赖软件
yum install -y yum-utils
- 设置阿里仓库
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
- 查看版本
yum list docker-ce --showduplicates | sort -r
- 选装指定版本
yum install docker-ce-20.10.10-3.el7 -y
yum install docker-ce-cli-20.10.10-3.el7 -y
- 启动服务
systemctl start docker
- 设置开机启动
systemctl enable docker
- 重新加载配置
systemctl daemon-reload
- 重启服务
systemctl restart docker
# 1.3 离线安装
# 1.4 Docker配置
- 编辑/etc/docker/daemon.json文件,加入镜像地址。
vim /etc/docker/daemon.json
{
"registry-mirrors": [
"https://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn"
],
"insecure-registries": ["202.96.122.219:1180"],
"log-opts": {"max-size": "500m", "max-file": "3"}
}
2
3
4
5
6
7
8
- 重启服务
systemctl restart docker
# 2. 【内部】测试环境
# 2.1 服务器IP
- 172.18.1.176
- 172.18.1.177
- 172.18.1.178
- 172.18.1.179
# 2.2 MySql 安装
- 172.18.1.178
docker pull mysql:5.7
- 挂载外部配置
mkdir -p /home/project/mysql5.7/conf
chmod 777 /home/project/mysql5.7/conf
mkdir -p /home/project/mysql5.7/data
chmod 777 /home/project/mysql5.7/data
vi /home/project/mysql5.7/conf/my.cnf
chmod 777 /home/project/mysql5.7/conf/my.cnf
[client]
default-character-set=utf8mb4
[mysql]
default-character-set=utf8mb4
[mysqld]
port=3306
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
# default: sql_mode= STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
# modeified:
sql_mode= STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
max_allowed_packet=10M
default-time_zone='+8:00'
lower_case_table_names=1
max_connections = 3000
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
docker run -itd --name mysql -p 3306:3306 \
--restart=always --privileged=true \
-v /home/project/mysql5.7/conf:/etc/mysql/conf.d \
-v /home/project/mysql5.7/data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=hq@auth mysql:5.7
2
3
4
5
6
mysql -h 172.18.1.178 -u root -p
create database if not exists usercenter default charset utf8 collate utf8_general_ci;
# 2.3 Redis 安装
- 172.18.1.179
- 创建目录
mkdir -p /opt/redis
mkdir -p /opt/redis/conf
mkdir -p /opt/redis/data
2
3
- 编辑配置文件
vi /opt/redis/conf/redis.conf
填入如下内容:
#端口
port 6379
#用守护线程的方式启动
daemonize yes
#redis可以外部访问
bind 0.0.0.0
#设置密码
requirepass usercenter
#redis持久化
appendonly yes
#防止出现远程主机强迫关闭了一个现有的连接的错误
tcp-keepalive 5
2
3
4
5
6
7
8
9
10
11
12
- 下载镜像
docker pull redis:6.2
- 运行容器
docker run -itd --name redis-server -p 6379:6379 \
-v /opt/redis/conf/redis.conf:/etc/redis/redis.conf \
-v /opt/redis/data:/data -d --restart=always \
--privileged=true redis:6.2 \
--appendonly yes --requirepass "usercenter"
2
3
4
5
# 2.4 auth-register
IP:172.18.1.176 172.18.1.177
开通防火墙
firewall-cmd --add-port=8000/tcp --permanent
firewall-cmd --reload
- 下载镜像
docker pull 202.96.122.219:1180/geely_usercenter/auth-register:tag
- 创建目录
mkdir -p /opt/auth/auth-register/config
上传配置到/opt/auth/auth-register/config
运行容器
sudo docker run --restart=on-failure:3 --name auth-register-tag --log-opt max-size=10m --log-opt max-file=3 --net=host -p 8000:8000 \
-v /opt/auth/auth-register/config:/opt/auth/auth-register/config \
-v /opt/auth/auth-register/logs:/opt/auth/auth-register/logs \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone:/etc/timezone:ro \
-e JAVA_OPTS='-Xmx1024M -Xms1024M' \
-d 202.96.122.219:1180/geely_usercenter/auth-register:tag
2
3
4
5
6
7
将上述auth-register-tag、auth-register:tag替换为实际的tag值。
# 2.5 auth-api-gateway
IP:172.18.1.176 172.18.1.177
开通防火墙
firewall-cmd --add-port=8002/tcp --permanent
firewall-cmd --reload
- 下载镜像
docker pull 202.96.122.219:1180/geely_usercenter/auth-api-gateway:tag
- 创建目录
mkdir -p /opt/auth/auth-api-gateway/config
上传配置到/opt/auth/auth-api-gateway/config
运行容器
sudo docker run --restart=on-failure:3 --name auth-api-gateway-tag --log-opt max-size=10m --log-opt max-file=3 --net=host -p 8002:8002 \
-v /opt/auth/auth-api-gateway/config:/opt/auth/auth-api-gateway/config \
-v /opt/auth/auth-api-gateway/logs:/opt/auth/auth-api-gateway/logs \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone:/etc/timezone:ro \
-e JAVA_OPTS='-Xmx1024M -Xms1024M' \
-d 202.96.122.219:1180/geely_usercenter/auth-api-gateway:tag
2
3
4
5
6
7
将上述auth-api-gateway-tag、auth-api-gateway:tag替换为实际的tag值。
# 2.6 auth-admin
IP:172.18.1.178 172.18.1.179
开通防火墙
firewall-cmd --add-port=10000/tcp --permanent
firewall-cmd --reload
- 下载镜像
docker pull 202.96.122.219:1180/geely_usercenter/auth-admin:tag
- 创建目录
mkdir -p /opt/auth/auth-admin/config
上传配置到/opt/auth/auth-admin/config
运行容器
sudo docker run --name auth-admin-tag --log-opt max-size=10m --log-opt max-file=3 --net=host -p 10000:10000 \
-v /opt/auth/auth-admin/config:/opt/auth/auth-admin/config \
-v /opt/auth/auth-admin/logs:/opt/auth/auth-admin/logs \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone:/etc/timezone:ro \
-e JAVA_OPTS='-Xmx1024M -Xms1024M' \
-d 202.96.122.219:1180/geely_usercenter/auth-admin:tag
2
3
4
5
6
7
将上述auth-admin-tag、auth-admin:tag替换为实际的tag值。
# 2.7 auth-security
- IP:172.18.1.178 172.18.1.179
firewall-cmd --add-port=8099/tcp --permanent
firewall-cmd --reload
- 下载镜像
docker pull 202.96.122.219:1180/geely_usercenter/auth-security:tag
- 创建目录
mkdir -p /opt/auth/auth-security/config
上传配置到/opt/auth/auth-security/config
运行容器
sudo docker run --restart=on-failure:3 --name auth-security-tag --log-opt max-size=10m --log-opt max-file=3 --net=host -p 8099:8099 \
-v /opt/auth/auth-security/config:/opt/auth/auth-security/config \
-v /opt/auth/auth-security/logs:/opt/auth/auth-security/logs \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone:/etc/timezone:ro \
-e JAVA_OPTS='-Xmx1024M -Xms1024M' \
-d 202.96.122.219:1180/geely_usercenter/auth-security:tag
2
3
4
5
6
7
将上述auth-security-tag、auth-security:tag替换为实际的tag值。
# 2.8 auth-html
- IP:172.18.1.176 172.18.1.177
- 下载镜像
docker pull 202.96.122.219:1180/geely_usercenter/auth-html:tag
- /opt/auth/auth-html/nginx/nginx.conf
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 100000;
}
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" '
'appId: "$http_appId" appId: "$http_appSecret"'
'"$http_user_agent" "$http_x_forwarded_for" $request_body';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
underscores_in_headers on;
#gzip on;
proxy_headers_hash_max_size 51200;
proxy_headers_hash_bucket_size 6400;
client_max_body_size 1000M;
include /etc/nginx/conf.d/*.conf;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
- /opt/auth/auth-html/nginx/conf/default.conf
upstream loadbalance_auth-api-gateway {
server 172.18.1.176:8002 weight=1;
server 172.18.1.177:8002 weight=1;
}
server {
listen 80;
server_name localhost;
location / {
try_files $uri $uri/ @router;
index index.html;
root /opt/auth/auth-html/;
}
location /api/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Nginx-Proxy true;
proxy_set_header Connection "";
# 此处地址与upstream处保持一致
proxy_pass http://loadbalance_auth-api-gateway/;
client_max_body_size 1000M;
}
location @router {
rewrite ^.*$ /index.html last;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 8000;
server_name localhost;
location / {
try_files $uri $uri/ @router;
index index.html;
root /opt/auth/auth-html/;
}
location /api/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Nginx-Proxy true;
proxy_set_header Connection "";
# 此处地址与upstream处保持一致
proxy_pass http://loadbalance_auth-api-gateway/;
client_max_body_size 1000M;
}
location @router {
rewrite ^.*$ /index.html last;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
- 运行容器
sudo docker run --name auth-html-tag -p 80:80 \
-v /opt/auth/auth-html/nginx/nginx.conf:/etc/nginx/nginx.conf \
-v /opt/auth/auth-html/nginx/logs:/var/log/nginx \
-v /opt/auth/auth-html/nginx/conf:/etc/nginx/conf.d \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone/timezone:/etc/timezone:ro \
-d 202.96.122.219:1180/geely_usercenter/auth-html:tag
2
3
4
5
6
7
# 3. 【客户】测试环境
在测试环境中,所有的应用均采用负载部署方式,各部署了两套。
# 3.1 auth-register
# 3.1.1 服务器IP
- 10.182.37.9
- 10.182.37.11
# 3.1.2 下载镜像
docker pull 202.96.122.219:1180/geely_usercenter/auth-register:tag
# 3.1.3 运行容器
sudo docker run --restart=on-failure:3 --name auth-register-tag --log-opt max-size=10m --log-opt max-file=3 --net=host -p 8000:8000 \
-v /opt/auth/auth-register/config:/opt/auth/auth-register/config \
-v /opt/auth/auth-register/logs:/opt/auth/auth-register/logs \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone:/etc/timezone:ro \
-e JAVA_OPTS='-Xmx1024M -Xms1024M' \
-d 202.96.122.219:1180/geely_usercenter/auth-register:tag
2
3
4
5
6
7
# 3.2 auth-admin
# 3.2.1 服务器IP
- 10.182.37.15
- 10.182.37.16
# 3.2.2 下载镜像
docker pull 202.96.122.219:1180/geely_usercenter/auth-admin:tag
# 3.2.3 运行容器
sudo docker run --name auth-admin --log-opt max-size=10m --log-opt max-file=3 --net=host -p 10000:10000 \
-v /opt/auth/auth-admin/config:/opt/auth/auth-admin/config \
-v /opt/auth/auth-admin/logs:/opt/auth/auth-admin/logs \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone:/etc/timezone:ro \
-e JAVA_OPTS='-Xmx1024M -Xms1024M' \
-d 202.96.122.219:1180/geely_usercenter/auth-admin:tag
2
3
4
5
6
7
8
9
# 3.3 auth-security
# 3.3.1 服务器IP
- 10.182.37.15
- 10.182.37.16
# 3.3.2 下载镜像
docker pull 202.96.122.219:1180/geely_usercenter/auth-security:tag
# 3.3.3 运行容器
sudo docker run --name auth-security-tag --log-opt max-size=10m --log-opt max-file=3 --net=host -p 8099:8099 \
-v /opt/auth/auth-security/config:/opt/auth/auth-security/config \
-v /opt/auth/auth-security/logs:/opt/auth/auth-security/logs \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone:/etc/timezone:ro \
-e JAVA_OPTS='-Xmx1024M -Xms1024M' \
-d 202.96.122.219:1180/geely_usercenter/auth-security:tag
2
3
4
5
6
7
8
9
# 3.4 auth-api-gateway
# 3.4.1 服务器IP
- 10.182.37.13
- 10.182.37.14
# 3.4.2 下载镜像
docker pull 202.96.122.219:1180/geely_usercenter/auth-api-gateway:tag
# 3.4.3 运行容器
sudo docker run --name auth-api-gateway --log-opt max-size=10m --log-opt max-file=3 --net=host -p 8002:8002 \
-v /opt/auth/auth-api-gateway/config:/opt/auth/auth-api-gateway/config \
-v /opt/auth/auth-api-gateway/logs:/opt/auth/auth-api-gateway/logs \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone:/etc/timezone:ro \
-e JAVA_OPTS='-Xmx512M -Xms512M' \
-d 202.96.122.219:1180/geely_usercenter/auth-api-gateway:tag
2
3
4
5
6
7
8
9
网关配置不是动态的,如果增加一台auth-security,网关要修改配置和重启
# 3.5 database
# 3.5.1 服务器IP
- 10.182.37.16 (TEST-APP2)
# 3.5.1 登录数据库
mysql -h ip -P 3306 -u usercenter -p密码
# 3.5.2 切换数据库
use usercenter;
# 3.6 html
# 3.6.1 服务器IP
- 10.182.37.10
- 10.182.37.12
# 3.6.2 下载镜像
docker pull 202.96.122.219:1180/geely_usercenter/auth-html:tag
# 3.6.3 运行容器
sudo docker run --name auth-html-tag -p 80:80 \
-v /opt/auth/auth-html/nginx/nginx.conf:/etc/nginx/nginx.conf \
-v /opt/auth/auth-html/nginx/logs:/var/log/nginx \
-v /opt/auth/auth-html/nginx/conf:/etc/nginx/conf.d \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone:/etc/timezone:ro \
-d 202.96.122.219:1180/geely_usercenter/auth-html:tag
2
3
4
5
6
7
8
9
# 4. 【客户】生产环境 **
在生产环境中,所有的应用均采用负载部署方式,各部署了两套。
# 4.1 auth-register
# 4.1.1 服务器IP
- 10.28.41.7
- 10.28.41.96
# 4.1.2 下载镜像
docker pull 202.96.122.219:1180/geely_usercenter/auth-register:tag
# 4.1.3 运行容器
sudo docker run --restart=on-failure:3 --name auth-register-tag --log-opt max-size=10m --log-opt max-file=3 --net=host -p 8000:8000 \
-v /opt/auth/auth-register/config:/opt/auth/auth-register/config \
-v /opt/auth/auth-register/logs:/opt/auth/auth-register/logs \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone:/etc/timezone:ro \
-e JAVA_OPTS='-Xmx1024M -Xms1024M' \
-d 202.96.122.219:1180/geely_usercenter/auth-register:tag
2
3
4
5
6
7
将上述auth-api-gateway-tag、auth-api-gateway:tag替换为实际的tag值。
# 4.2 auth-admin
# 4.2.1 服务器IP
- 10.28.41.9
- 10.28.41.99
# 4.2.2 下载镜像
docker pull 202.96.122.219:1180/geely_usercenter/auth-admin:tag
# 4.2.3 运行容器
sudo docker run --restart=on-failure:3 --name auth-admin-tag --log-opt max-size=10m --log-opt max-file=3 --net=host -p 10000:10000 \
-v /opt/auth/auth-admin/config:/opt/auth/auth-admin/config \
-v /opt/auth/auth-admin/logs:/opt/auth/auth-admin/logs \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone:/etc/timezone:ro \
-e JAVA_OPTS='-Xmx1024M -Xms1024M' \
-d 202.96.122.219:1180/geely_usercenter/auth-admin:tag
2
3
4
5
6
7
将上述auth-api-gateway-tag、auth-api-gateway:tag替换为实际的tag值。
# 4.3 auth-security
# 4.3.1 服务器IP
- 10.28.41.9
- 10.28.41.99
# 4.3.2 下载镜像
docker pull 202.96.122.219:1180/geely_usercenter/auth-security:tag
# 4.3.3 运行容器
sudo docker run --restart=on-failure:3 --name auth-security-tag --log-opt max-size=10m --log-opt max-file=3 --net=host -p 8099:8099 \
-v /opt/auth/auth-security/config:/opt/auth/auth-security/config \
-v /opt/auth/auth-security/logs:/opt/auth/auth-security/logs \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone:/etc/timezone:ro \
-e JAVA_OPTS='-Xmx1024M -Xms1024M' \
-d 202.96.122.219:1180/geely_usercenter/auth-security:tag
2
3
4
5
6
7
将上述auth-api-gateway-tag、auth-api-gateway:tag替换为实际的tag值。
# 4.4 auth-api-gateway
# 4.4.1 服务器IP
- 10.28.41.8
- 10.28.41.98
# 4.4.2 下载镜像
docker pull 202.96.122.219:1180/geely_usercenter/auth-api-gateway:tag
# 4.4.3 运行容器
sudo docker run --restart=on-failure:3 --name auth-api-gateway-tag --log-opt max-size=10m --log-opt max-file=3 --net=host -p 8002:8002 \
-v /opt/auth/auth-api-gateway/config:/opt/auth/auth-api-gateway/config \
-v /opt/auth/auth-api-gateway/logs:/opt/auth/auth-api-gateway/logs \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone:/etc/timezone:ro \
-e JAVA_OPTS='-Xmx512M -Xms512M' \
-d 202.96.122.219:1180/geely_usercenter/auth-api-gateway:tag
2
3
4
5
6
7
8
将上述auth-api-gateway-tag、auth-api-gateway:tag替换为实际的tag值。
# 4.5 auth-init
# 4.5.1 服务器IP
- 10.28.41.99
# 4.5.2 下载镜像
docker pull 202.96.122.219:1180/geely_usercenter/auth-init:tag
# 4.5.3 运行容器
sudo docker run --name auth-init --net=host -p 8100:8100 \
-v /opt/auth/auth-init/config:/opt/auth/auth-init/config \
-v /opt/auth/auth-init/logs:/opt/auth/auth-init/logs \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone:/etc/timezone:ro \
-e JAVA_OPTS='-Xmx1024M -Xms1024M' \
-d 202.96.122.219:1180/geely_usercenter/auth-init:tag
2
3
4
5
6
7
8
# 4.6 html
# 4.6.1 服务器IP
- 10.28.41.6
- 10.28.41.97
# 4.6.2 下载镜像
docker pull 202.96.122.219:1180/geely_usercenter/auth-html:tag
# 4.6.3 运行容器
sudo docker run --restart=on-failure:3 --name auth-html-tag -p 80:80 \
-v /opt/auth/auth-html/nginx/nginx.conf:/etc/nginx/nginx.conf \
-v /opt/auth/auth-html/nginx/logs:/var/log/nginx \
-v /opt/auth/auth-html/nginx/conf:/etc/nginx/conf.d \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone:/etc/timezone:ro \
-d 202.96.122.219:1180/geely_usercenter/auth-html:tag
2
3
4
5
6
7
8
将上述auth-api-gateway-tag、auth-api-gateway:tag替换为实际的tag值。
- /opt/auth/auth-html/nginx/nginx.conf
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 100000;
}
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" '
'appId: "$http_appId" appId: "$http_appSecret"'
'"$http_user_agent" "$http_x_forwarded_for" $request_body';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
underscores_in_headers on;
#gzip on;
proxy_headers_hash_max_size 51200;
proxy_headers_hash_bucket_size 6400;
client_max_body_size 1000M;
include /etc/nginx/conf.d/*.conf;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
- /opt/auth/auth-html/nginx/conf/default.conf
upstream loadbalance_auth-api-gateway {
server 10.28.41.8:8002 weight=1;
server 10.28.41.98:8002 weight=1;
}
server {
listen 80;
server_name localhost;
location / {
try_files $uri $uri/ @router;
index index.html;
root /opt/auth/auth-html/;
}
location /api/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Nginx-Proxy true;
proxy_set_header Connection "";
# 此处地址与upstream处保持一致
proxy_pass http://loadbalance_auth-api-gateway/;
client_max_body_size 1000M;
}
location @router {
rewrite ^.*$ /index.html last;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 8000;
server_name localhost;
location / {
try_files $uri $uri/ @router;
index index.html;
root /opt/auth/auth-html/;
}
location /api/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Nginx-Proxy true;
proxy_set_header Connection "";
# 此处地址与upstream处保持一致
proxy_pass http://loadbalance_auth-api-gateway/;
client_max_body_size 1000M;
}
location @router {
rewrite ^.*$ /index.html last;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# 4.7 database
# 4.7.1 服务器IP
- 10.28.41.99 (PRD-APP2)
# 4.7.2 登录数据库
mysql -h 主机地址 -P 端口 -u 用户 -p密码
# 4.7.3 切换数据库
use usercenter;
# 4.7.4 数据库备份
mysqldump -u用户 -p -h主机地址 -P端口 --default-character-set=utf8 --ignore-table=usercenter.t_auth_log usercenter > /home/usercenter.sql
密码