部署流程

后台安装(除了修改hosts文件,其他全部在action用户下操作)

  1. 建立action用户
    useradd -m action
  2. 切换到action用户
    su - action
  3. 安装MySQL 8.x数据库
  4. 导入数据库数据
    unzip db.zip
    mysql -uroot -p
    进入mysql依次执行:
source 0hzsystemx_boot.sql;
source 1schema.sql;
source 2hzsystemx.sql;
source 3hzsystemx_flow.sql;
source 4hzsystemx_job.sql;
source 5hzsystemx_mp.sql;
source 6hzsystemx_config.sql;
source 7hzsystemx_pay.sql;
source 8hzsystemx_codegen.sql;
source 9hzsystemx_action.sql;
source 99hzsystemx_bi.sql;
source 999hzsystemx_app.sql;
  1. 安装java
    unzip java.zip
    vi ~/.bashrc加入下面内容:
export JAVA_HOME=~/java/jdk-17
export PATH=$JAVA_HOME/bin:$PATH
export MYSQL_USER=root
export MYSQL_PWD=<MySQL root密码>
export REDIS_PWD=<redis密码>

source .bashrc
java -version查看是否java17

  1. 安装redis,使用下面命令测试redis是否可连接
    redis密码一般配置在/etc/redis/redis.conf/etc/redis.conf文件中的requirepass <密码>,如果没有要加上这一句
redis-cli 
auth <密码>
  1. 配置hosts
    sudo vi /etc/hosts,加入下面内容:
127.0.0.1 hzsystem-register
127.0.0.1 hzsystem-gateway
127.0.0.1 hzsystem-redis
127.0.0.1 hzsystem-xxl
127.0.0.1 hzsystem-mysql
127.0.0.1 hzsystem-sentinel
127.0.0.1 hzsystem-monitor
127.0.0.1 hzsystem-seata
  1. 测试端口8848,9999等是否被占用:telnet 127.0.0.1 8848curl -v telnet://127.0.0.1:9999,如被占用处理占用端口
  2. /home/action目录下执行unzip action.zip
  3. chown -R action:action /home/action
  4. chmod -R 755 /home/action
  5. 检查字体库/usr/share/fonts/dejavu/目录,如果没有解压dejavu.zip/usr/shar/fonts目录下
  6. cd action
  7. ./start.sh启动必须在action用户下操作,并检查当前目录是不是action用户和action用户组

MySQL配置(root用户操作)

  1. /etc/my.cnf
  2. [mysqld]下加入下面内容
group_concat_max_len=1048576
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
  1. systemctl restart mysqld

前端安装(root用户操作)

安装nginx
  1. su - root
  2. tar xvf nginx-1.25.2.tar
  3. tar xvf headers-more-nginx-module-0.38.tar
  4. 编译安装nginx(注意命令中headers-more-nginx-module-0.38目录为准
    cd nginx-1.25.2
./configure --prefix=/usr/local/nginx \
            --add-module=/root/headers-more-nginx-module-0.38 \
            --with-http_ssl_module \
            --with-http_gzip_static_module

make
make install

如果报:./configure: error: SSL modules require the OpenSSL library.
换成,这样将不支持https协议:

./configure --prefix=/usr/local/nginx \
            --add-module=/root/headers-more-nginx-module-0.38 \
            --with-http_gzip_static_module
make
make install

安装nginx服务
vi /usr/lib/systemd/system/nginx.service加入下面内容:

[Unit]
Description=Nginx HTTP Server
After=network.target
 
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
PrivateTmp=true
 
[Install]
WantedBy=multi-user.target

systemctl daemon-reload
systemctl enable nginx
systemctl start nginx
vi ~/.bashrc加上内容:
export PATH=$PATH:/usr/local/nginx/sbin
source ~/.bashrc
配置nginx
cd /usr/local/nginx/conf/
mkdir conf.d
cp nginx.conf nginx.old
vi 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  1024;
}


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"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    include /usr/local/nginx/conf/conf.d/*.conf;

}

cd conf.d
vi action-web.conf
加入下面内容

server {
    gzip on;
    gzip_static on;     # 需要http_gzip_static_module 模块
    gzip_min_length 1k;
    gzip_comp_level 4;
    gzip_proxied any;
    gzip_types text/plain text/xml text/css;
    gzip_vary on;
    gzip_http_version   1.0; #兼容多层nginx 反代
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";
    client_max_body_size 10m;

#    listen 443 ssl; 
     listen 80;
     server_name localhost;
#    ssl_certificate /cert/www.ccuct.com_cert_chain.pem;
#    ssl_certificate_key /cert/www.ccuct.com_key.key;
#    ssl_session_cache shared:SSL:1m;
#    ssl_session_timeout 5m;
#    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
#    ssl_prefer_server_ciphers on;

    # 打包好的dist目录文件,放置到这个目录下
    root /home/action/action-web/dist/;


   location / {
       alias /home/action/action-web/dist/;
       index  index.html index.htm;
   }


    location ~* ^/api/admin/sys-file {
       proxy_pass http://127.0.0.1:9999;
       more_set_headers "Cache-Control: public, max-age=3600";
       more_set_headers "Expires: 3600s";
       more_clear_headers "Pragma";
    }

    # 注意维护新增微服务,gateway 路由前缀
    location ^~/api/ {
        proxy_pass http://localhost:9999/; #注意/后缀
        proxy_connect_timeout 60s;
        proxy_read_timeout 120s;
        proxy_send_timeout 120s;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto http;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
    }

    # 避免端点安全问题
    if ($request_uri ~ "/actuator"){
        return 403;
    }
}

#server {
#        listen 80;
#        #换成你的域名
#        server_name  www.ccuct.com;
#        #重定向到https
#        return 301 https://$server_name$request_uri;
#}

nginx -s reload

如果验证码图形不出来 ,可安装字体库
yum install fontconfig
fc-cache --force
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容