栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

阿里云项目部署

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

阿里云项目部署

阿里云项目部署
  • 环境安装
    • 系统 Debian GUN
    • 安装 JDK
    • 安装 redis
    • 安装 ngnix
      • ngnix配置
    • 安装 mysql
      • 配置 mysql
    • 安装 docker
      • 安装 minio文件系统
    • 配置 hosts
    • 阿里云配置
      • ECS安全组
      • 解析域名

环境安装 系统 Debian GUN 安装 JDK
apt install openjdk-8-jdk
java -version
安装 redis
apt-get install redis-server
安装 ngnix
apt-get install nginx
/etc/init.d/nginx start //启动
/etc/init.d/nginx stop  //停止
ngnix配置

server {
    listen 80;
    server_name your realm name;  //阿里云域名

    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_disable "MSIE [1-6].(?!.*SV1)";

    # 前端打包好的dist目录文件
    root /home/pigx-ui;

    # 若新增后端路由前缀注意在此处添加(|新增)
    location ~* ^/(code|auth|admin|monitor|gen|job|tx|act|mp|pay) {
       proxy_pass http://pigx-gateway:9999;
       proxy_connect_timeout 15s;
       proxy_send_timeout 15s;
       proxy_read_timeout 15s;
       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;
    }

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

server {
    listen 443;
    server_name your realm name;  //阿里云域名
    root /home/pigx-ui;
 
    index index.html index.html; 
                
    gzip on;
    gzip_static on;     # 闂団偓鐟曚弓ttp_gzip_static_module 濡€虫健
    gzip_min_length 1k;
    gzip_comp_level 9;
    gzip_proxied any;
    gzip_types text/plain application/javascript application/x-javascript text/css text/xml application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
    gzip_vary on;
    gzip_disable "MSIE [1-6].(?!.*SV1)";  
      
}
安装 mysql
wget https://dev.mysql.com/get/mysql-apt-config_0.8.12-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.12-1_all.deb
apt-get update
apt-get install mysql-server
注:
过程中有两个弹窗
第一个是设置、确认密码(设置数据库密码)
另一个是选择加密方式,选第一个
配置 mysql
开放远程访问,以连接可视化图形界面
mysql -u root -p
输入密码
show databases;
use mysql;
select host, user, authentication_string, plugin from user;
更改加密方式
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '***';(***'密码)
flush privileges;
update user host='%' where user='root';
flush privileges;
开放远程访问权限(授权远程连接)
grant all on *.* to 'root'@'%';
flush privileges;
安装 docker
apt-get remove docker docker-engine docker.io containerd runc
apt-get update

apt-get install 
    apt-transport-https 
    ca-certificates 
    curl 
    gnupg2 
    software-properties-common
    
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/debian/gpg | sudo apt-key add -
apt-key fingerprint 0EBFCD88

add-apt-repository 
   "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/debian 
  $(lsb_release -cs) 
  stable"
  
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io
apt-cache madison docker-ce

sudo apt-get install docker-ce= docker-ce-cli= containerd.io
docker run hello-world  //测试是否安装成功
安装 minio文件系统
# 9000端口是API 通信端口, 9001是web管理台地址
docker run -p 9000:9000 -p 9001:9001 --name minio1 
  -e "MINIO_ROOT_USER=lengleng" 
  -e "MINIO_ROOT_PASSWORD=lengleng" 
  minio/minio:RELEASE.2021-08-25T00-41-18Z.fips server /data --console-address ":9001"

docker ps -a    //查看docker所有的容器,包括未运行的
配置 hosts
vim /etc/hosts

127.0.0.1 pigx-register
127.0.0.1 pigx-gateway
127.0.0.1 pigx-redis
127.0.0.1 pigx-mysql
127.0.0.1 pigx-sentinel
127.0.0.1 pigx-xxl

source /etc/hosts
阿里云配置 ECS安全组

解析域名

记录值就是申请的公网IP
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/361330.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号