jenkins docker-compose备份

docker-compose.yaml

version: '3.7'

services:
  jks_web:
    image: jenkinsci/blueocean:1.21.0-bcc31d32159f
    container_name: jks
    environment:
       TZ: 'Asia/Shanghai'
    ports:
      - '8080:8080'
      - '50000:50000'
    volumes:
       - './jks_home:/var/jenkins_home'
       - '/var/run/docker.sock:/var/run/docker.sock'
       - '/usr/bin/docker:/usr/bin/docker'
    restart: always

添加用户命令adduser jenkins
给目录授权命令chown jenkins:jenkins jks_home/

nginx配置

server {
    listen 80;
    server_name xxx.test.com;
    index index.html index.php index.htm;

    return      301 https://$server_name$request_uri;      #这是nginx最新支持的写法

    location ~ / {
    root  /home/travel/pki-validation;
    index index.html index.php index.htm;
    }
 }

server {
        listen       443 ssl http2;
        server_name  xxx.test.com;

        charset utf-8;
        #index index.html index.htm;
        ssl_certificate  ./fullchain.cer;
        ssl_certificate_key ./test.com.key;
        ssl_session_timeout 5m;
        #优先采取服务器算法
        ssl_prefer_server_ciphers on;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;

        root         /usr/share/nginx/html;

         location / {
                 proxy_set_header        Host $host:$server_port;
                 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 $scheme;
                 proxy_redirect http:// https://;
                 proxy_pass             http://192.168.5.21:8080; #代理
                 # Required for new HTTP-based CLI
                  proxy_http_version 1.1;
                  proxy_request_buffering off;
                  proxy_buffering off; # Required for HTTP-based CLI to work over SSL
                  # workaround for https://issues.jenkins-ci.org/browse/JENKINS-45651
                 add_header 'X-SSH-Endpoint' 'xxx.test.com:50000' always;
         }

}

暂无评论
发表新评论