当前位置: 首页 > article >正文

nexus部署及配置https访问

1. 使用docker-compose部署nexus

  1. docker-compose-nexus.yml

    version: "3"
    services:
      nexus:
        container_name: my-nexus
        image: sonatype/nexus3:3.67.1
        hostname: my-nexus
        network_mode: host
        ports:
          - 8081:8081
        deploy:
          resources:
            limits:
              cpus: '4'
              memory: 8192M
            reservations:
              cpus: '4'
              memory: 4096M
        healthcheck:
          test: ["CMD", "curl", "-f", "http://localhost:8081"]
          interval: 30s
          timeout: 10s
          retries: 3
        volumes:
          - "/data/nexus:/nexus-data"
          - "/etc/localtime:/etc/localtime"
        restart: always
        
    
  2. 部署

    docker-compose -f docker-compose-nexus.yml up -d
    
  3. 根据自己服务器IP地址,配置hosts

    vim /etc/hosts
    
    192.168.xxx.xxx my-nexus
    
  4. 防火墙开放8081端口

    firewall-cmd --zone=public --add-port=8081/tcp --permanent
    firewall-cmd --reload
    
  5. web访问

    http://192.168.xxx.xxx:8081

    用户名:admin

    容器创建会生成默认密码,在容器内的/nexus-data/admin.password中。由于做了数据卷映射。所以在宿主机/data/nexus中也能看到admin.password

    使用默认密码登录成功后,根据提示修改密码

2. 配置https访问

  1. docker-compose-nginx.yml

    version: "3"
    services:
      nginx:
         restart: always
         image: nginx:1.26.2
         container_name: my-nginx
         hostname: my-nginx
         network_mode: host
         privileged: true
         volumes:
           - "/config/nginx/nginx.conf:/etc/nginx/nginx.conf"
           - "/config/nginx/conf.d:/etc/nginx/conf.d"
           - "/logs/nginx:/var/log/nginx"
           - "/data/nginx:/data/nginx"
    
  2. ssl证书及配置文件

    • 自己生成ssl证书,放到指定目录

    • 配置文件

      server {
              listen    18081 ssl;
              server_name  localhost;
              ssl_certificate      /etc/nginx/conf.d/certs/server.crt;
              ssl_certificate_key  /etc/nginx/conf.d/certs/server.key;
              ssl_session_cache    shared:SSL:1m;
              ssl_session_timeout  5m;
              ssl_protocols TLSv1.2 TLSv1.3;
              ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256;
              ssl_prefer_server_ciphers  on;
      		server_tokens off;
      		add_header Strict-Transport-Security "max-age=3600; includeSubDomains";
              client_max_body_size 2000m;
              root html;
       	      charset 'utf-8';
      		
      		location / {
      			proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
      			proxy_set_header    Host $http_host;
      			proxy_set_header   X-Forwarded-Proto https;  # 转发时使用https协议
      			server_name_in_redirect on;
      			proxy_pass      http://my-nexus:8081;
              }
      	
      }
      
  3. 部署

    docker-compose -f docker-compose-nginx.yml up -d
    
  4. 根据服务器IP,配置hosts

    vim /etc/hosts
    
    192.168.xxx.xxx my-nginx
    
  5. 防火墙开放18081端口

    firewall-cmd --zone=public --add-port=18081/tcp --permanent
    firewall-cmd --reload
    
  6. web访问

    https://192.168.xxx.xxx:18081


http://www.kler.cn/a/536727.html

相关文章:

  • ASP.NET Core中间件Markdown转换器
  • windows 蓝牙驱动开发-传输总线驱动程序常见问题
  • intra-mart实现简易登录页面笔记
  • 力扣.623. 在二叉树中增加一行(链式结构的插入操作)
  • 【WebLogic】Oracle发布WebLogic 14c最新版本-14.1.2.0
  • 微软发布基于PostgreSQL的开源文档数据库平台DocumentDB
  • 洛谷P8218 【深进1.例1】求区间和(前缀和)
  • ubuntu中 使用C++ FFmpeg拉取RTSP视频流
  • mapbox进阶,添加绘图扩展插件,绘制圆形
  • spring boot接收请求常用注解
  • 【华为OD机考】华为OD笔试真题解析(1)--AI处理器组合
  • 音视频的文件封装——AVI、MP4、MKV
  • [深度学习]神经网络-回归项目
  • Unity游戏(Assault空对地打击)开发(7) 爆炸效果
  • 前沿型CLI库——Clipanion
  • Qt 获取鼠标所在点颜色的RGB值,考虑多屏幕情况
  • 机器学习 - 容易混淆的目标函数和损失函数
  • 借助 Cursor 快速实现小程序前端开发
  • 探秘数据结构之单链表:从原理到实战的深度解析
  • ​零技术开始,但想用 Next.js 基于 React 构建一个类似 18Touch 的网站​
  • 【开源项目】数字孪生武汉~超经典智慧城市CIM/BIM数字孪生可视化项目——开源工程及源码
  • (文末提供数据集下载)ML.NET库学习001:基于PCA的信用卡异常检查之样本处理与训练
  • 如何在Windows上使用Docker
  • OCR与多模态大模型的关系
  • PDF转图片及拼接- ImageMagick
  • 【学习笔记】OpenGL的基础纹理贴图相关知识