Nginx配置Jenkins二级域名,以及443 SSL证书访问

admin
2022-05-08 / 0 评论 / 259 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2022年05月08日,已超过691天没有更新,若内容或图片失效,请留言反馈。

nginx配置jenkins二级域名,以及443 SSL访问

新增配置文件

server
{   listen 443;
    #listen 80;
    server_name jenkins.yanxizhu.com;

    #error_page 404/404.html;
    ssl_certificate    /etc/nginx/conf.d/jenkins.yanxizhu.com_bundle.crt;
    ssl_certificate_key    /etc/nginx/conf.d/jenkins.yanxizhu.com.key;
    ssl_session_cache shared:SSL:1m;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    error_page 497  https://$host$request_uri;

    #Location配置
    location / {
        proxy_set_header X-Rea $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-Nginx-Proxy true;
        proxy_pass http://xx.xxx.xx.xx:10240;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    access_log  /var/log/nginx/jenkins.yanxizhu.com.log;
}
server {
    listen       80;
    server_name  jenkins.yanxizhu.com;
    rewrite ^(.*) https://jenkins.yanxizhu.com$1 permanent;
}

注意:自己的端口以及ip地址和域名,以及域名解析配置、SSL证书名字根据自己的修改。

2

评论 (0)

取消