请先阅读基础部署方式:
个人应用交互流程
服务号交互流程
静态资源nginx代理访问

将静态资源部署于nginx下
cd /data/eim/www
mkdir -p talentmarket/
cd talentmarket
unzip pc.zip
unzip mobile.zip
unzip server.zip
新建数据库
CREATE DATABASE apps_talentmarket DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
grant all privileges on apps_talentmarket.* to 'eim'@'localhost' ;
grant all privileges on apps_talentmarket.* to 'eim'@'%' ;
flush privileges;
新建应用
pc端应用-->本地应用:
http://domain:port/talentmarket/mobile/static/transfer.html?type=pc

安卓应用-->web应用:
http://domain:port/talentmarket/mobile/static/transfer.html?type=mobile

iOS应用-->web应用:
http://domain:port/talentmarket/mobile/static/transfer.html?type=mobile
启动
nohup /usr/local/jdk1.8.0_111/bin/java -Dconfig.zookeeper.connectString=10.10.10.10:2181,10.10.10.11:2181,10.10.10.12:2181 -Dconfig.rootNode=/eim_config -Dconfig.version=eim -jar /data/eim/apps/talentmarket-*-exec.jar > /data/eim/apps/logs/talentmarket.log 2>&1 &

# 添加到系统开机自启动
vim /etc/rc.local
# 添加以上启动命令
haproxy代理
        acl gate-server path_beg -i /gate/proxy/talentmarket
        use_backend gate-server if gate-server

        ##根据实际情况控制互联网IP访问管理后台 /talentmarket/server
        acl nginx-server path_beg -i /talentmarket/pc /talentmarket/server /talentmarket/mobile
        use_backend nginx-server if nginx-server

backend gate-server
        mode http
        option forwardfor
        server 119-8081  10.10.10.100:8081 check inter 10s

backend nginx-server
        mode http
        option forwardfor
        server wget 10.10.10.100:80 check inter 10s
后端服务talentmarket-*-exec.jar、后台前端页面server.zip部署在内网
将静态资源部署于内网nginx下
cd /data/eim/www
mkdir -p talentmarket/
cd talentmarket
unzip server.zip
  • 内网gate添加规则:
    添加三条情景模式 /avatar/* 、 /api/fs/* 、/cloudfs/* ,路由到外网的haproxy
  • 内网Nginx添加代理配置:

vim /etc/nginx/conf.d/default.conf


upstream gate {
      server 内网gate服务IP端口:8081;
}

upstream talentmarket {
      server 10.10.10.100:8898;
}



server {
    listen 80 default_server;
... ...
中间略
... ...

# 人才市场server管理后台静态资源
    location  /talentmarket/server {
        root   /data/eim/www/talentmarket/server;
        index  index.html index.htm;
    }

# 人才市场服务端
    location ^~ /talentmarket/ {
        proxy_pass http://talentmarket;
    }

    location ^~ (/avatar/|/api/fs/|/cloudfs/) {
        rewrite /avatar/(.*) /gate/proxy/avatar/$1 break;
        rewrite /api/fs/(.*) /gate/proxy/api/fs/$1 break;
        rewrite /cloudfs/(.*) /gate/proxy/cloudfs/$1 break;
        proxy_pass http://gate;
    }


    location / {
        root   /data/eim/www;

}
  • 内网使用haproxy代理配置如下:
frontend http_talentmarket_neiwang_in
        bind *:666
        mode http
        #log global
        option httplog
        option httpclose
        option forwardfor

        acl tomcat-server path_beg -i  /talentmarket/server
        use_backend tomcat-server if tomcat-server

        acl talentmarket-server path_beg -i  /talentmarket /gate/proxy/talentmarket
        use_backend talentmarket-server if talentmarket-server

        acl gate-server path_beg -i /avatar  /api/fs /cloudfs
        use_backend gate-server if gate-server


backend talentmarket-server
        mode http
        option forwardfor
        server 100-8198  10.10.10.100:8898 check inter 10s

backend gate-server
        mode http
        option forwardfor
        reqirep ^([^\ ]*)\ /avatar/(.*)     \1\ /gate/proxy/avatar/\2
        reqirep ^([^\ ]*)\ /api/fs/(.*)     \1\ /gate/proxy/api/fs/\2
        reqirep ^([^\ ]*)\ /cloudfs/(.*)     \1\ /gate/proxy/cloudfs/\2
        server wget 10.10.10.100:8081 check inter 10s

backend tomcat-server
        mode http
        option forwardfor
        server wget 10.10.10.100:8082 check inter 10s
外网gate添加规则:
添加情景模式 /talentmarket/* ,路由到内网的服务端访问地址
  • 且企信需添加该内网访问地址为白名单
    将配置中心/eim_config/eim/cas下,allowed.out.servers的值添加内网访问地址,如内网nginx的访问地址http://10.20.30.40:80
    并重启cas,使之生效

  • 人才市场管理后台地址
    http://内网nginx的IP:端口/talentmarket/server/