Running Jenkins behind Nginx
original : https://wiki.jenkins-ci.org/display/JENKINS/Running+Jenkins+behind+Nginx
In situations where you have existing web sites on your server, you may find it useful to run Jenkins (or the servlet container that Jenkins runs in) behind Nginx, so that you can bind Jenkins to the part of a bigger website that you may have. This document discusses some of the approaches for doing this.
When a request arrives for certain URLs, Nginx becomes a proxy and further forward that request to Jenkins, then it forwards the response back to the client. A typical set up for mod_proxy would look like this:
server {
listen 80; # Listen on port 80 for IPv4 requests
server_name jenkins.example.com;
#this is the jenkins web root directory (mentioned in the /etc/default/jenkins file)
root /var/run/jenkins/war/;
access_log /var/log/nginx/jenkins/access.log;
error_log /var/log/nginx/jenkins/error.log;
location ~ "^/static/[0-9a-fA-F]{8}\/(.*)$" {
#rewrite all static files into requests to the root
#E.g /static/12345678/css/something.css will become /css/something.css
rewrite "^/static/[0-9a-fA-F]{8}\/(.*)" /$1 last;
}
location /userContent {
#have nginx handle all the static requests to the userContent folder files
#note : This is the $JENKINS_HOME dir
root /var/lib/jenkins/;
if (!-f $request_filename){
#this file does not exist, might be a directory or a /**view** url
rewrite (.*) /$1 last;
break;
}
sendfile on;
}
location @jenkins {
sendfile off;
proxy_pass http://127.0.0.1:8080;
proxy_redirect default;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_max_temp_file_size 0;
#this is the maximum upload size
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
location / {
# Optional configuration to detect and redirect iPhones
if ($http_user_agent ~* '(iPhone|iPod)') {
rewrite ^/$ /view/iphone/ redirect;
}
try_files $uri @jenkins;
}
}
This assumes that you run Jenkins on port 8080. Remember to create the folder /var/log/nginx/jenkins.
Running Jenkins behind Nginx的更多相关文章
- Jenkins+Github+Nginx实现前端项目自动部署
前言 最近在搭建一个自己的网站,网站框架搭好了要把项目放到服务器运行,但是每次更新网站内容就要手动部署一次,实在很麻烦,于是就想搭建一套自动化部署的服务.看了一些案例最后选用现在比较主流的Jenkin ...
- 【网易严选】iOS持续集成打包(Jenkins+fastlane+nginx)
本文来自网易云社区 作者:孙娇 严选iOS客户端的现有打包方式是通过远程连接打包机执行脚本去打包,打完包会输出相应的ipa的二维码,扫一扫二维码可以安装,但是随着测试队伍的壮大,外包同学越来越多,在打 ...
- 使用 jenkins 为 nginx 增加上下文
每次需要在Nginx增加上下文,都需要添加如下两段 server.conf upstream serverdownloadPage { server 10.11.19.6:3023; } ht ...
- 一步一步配置docker(tomcat+jenkins+phpmyadmin+nginx)
经过半个月的docker学习实践,今天对自己的学习成果做个总结. 貌似官方推荐的是docker compose使用DockerFile 来配置,但目前还没学习使用docker compose,先学习通 ...
- jenkins+docker+nginx+tomcat实现vue项目部署
一.项目准备 1.新建一个vue的项目,确保能在浏览器正常访问.然后在项目的根目录下新建一个Dockerfile的文件,内容如下 FROM nginx COPY dist /usr/share/ngi ...
- Jenkins+git+Nginx
1.Jenkins 一.tomcat安装 1.下载JDK和Tomcat //通过wget下载 wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomca ...
- 使用 Jenkins + GitHub + Nginx + HTTPS 搭建静态网站
参考https://www.imooc.com/article/20079 http://www.haoduoyu.cc/
- Nginx 配置 Jenkins 反向代理
安装 Nginx 参考之前的一篇文章 Nginx 安装配置 安装 Jenkins 参考之前的一篇文章 Linux 搭建 Jenkins Nginx 配置 Jenkins 的反向代理 # /etc/ng ...
- 关于nginx反代jenkins报错 反向代理设置有误
官方文档地址: https://wiki.jenkins.io/display/JENKINS/Running+Jenkins+behind+Nginx 直接解决的配置文件吧. 这是使用子域名,不使用 ...
随机推荐
- Python3 turtle安装和使用教程
Python3 turtle安装和使用教程 Turtle库是Python语言中一个很流行的绘制图像的函数库,想象一个小乌龟,在一个横轴为x.纵轴为y的坐标系原点,(0,0)位置开始,它根据一组函数 ...
- 高能天气——团队Scrum冲刺阶段-Day 1-领航
高能天气--团队Scrum冲刺阶段-Day 1-领航 各个成员在 Alpha 阶段认领的任务 经过重新的团队讨论,我们最新确定的α版本所需实现内容如下: 查找城市:切换城市按钮.滑动界面视图 天气预报 ...
- 005.KVM日常管理2-virt管理
一 安装管理工具 [root@kvm-host ~]# rpm -qa|grep libguestfs-tools #查看相关管理工具,若没安装,可使用yum安装. 二 日常管理 2.1 命令格式 ...
- Parcel极速零配置Web应用打包工具
当听到极速零配置打包,我不经兴奋起来,零配置!!!想起在webpack打包的配置,这个零配置着实让我好奇不已,迅速学习一波. Parcel(parcel 英[ˈpɑ:sl] 美[ˈpɑ:rsl])有以 ...
- css细节:尖角处理
在各种网站里面,我们会经常看到类似于这样的尖角:(示例:新浪微博) 它实现的方式有多种,哪种才是最简单的?哪种才是最优秀的?首先我声明一下,我还不清楚这个东西具体叫什么名字(哪位知道还望告知),暂且叫 ...
- 慎重使用volatile关键字
volatile关键字相信了解Java多线程的读者都很清楚它的作用.volatile关键字用于声明简单类型变量,如int.float.boolean等数据类型.如果这些简单数据类型声明为volatil ...
- 无线网络实体图生成工具airgraph-ng
无线网络实体图生成工具airgraph-ng airgraph-ng是aircrack-ng套件提供的一个图表生成工具.该工具可以根据airodump工具生成的CSV文件绘制PNG格式的图.绘制的 ...
- DIM-00014: Cannot open the Windows NT Service Control Manager.
创建Oracle数据库时出错: OPW-00001: Unable to open password-file DIM-00014: Cannot open the Windows NT Servic ...
- 解决org.apache.jasper.JasperException: org.apache.jasper.JasperException: XML parsing error on file org.apache.tomcat.util.scan.MergedWebXml
1.解决办法整个项目建立时采用utf-8编码,包括代码.jsp.配置文件 2.并用最新的tomcat7.0.75 相关链接: http://ask.csdn.net/questions/223650
- BZOJ.4514.[SDOI2016]数字配对(费用流SPFA 二分图)
BZOJ 洛谷 \(Solution\) 很显然的建二分图后跑最大费用流,但有个问题是一个数是只能用一次的,这样二分图两部分都有这个数. 那么就用两倍的.如果\(i\)可以向\(j'\)连边,\(j\ ...