Skip to content

Instantly share code, notes, and snippets.

@rdegges
Created April 11, 2011 05:30
Show Gist options
  • Save rdegges/913102 to your computer and use it in GitHub Desktop.
Save rdegges/913102 to your computer and use it in GitHub Desktop.
Create a HTTP proxy for jenkins using NGINX.
sudo aptitude -y install nginx
cd /etc/nginx/sites-available
sudo rm default
sudo cat > jenkins
upstream app_server {
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80;
listen [::]:80 default ipv6only=on;
server_name ci.yourcompany.com;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://app_server;
break;
}
}
}
^D # Hit CTRL + D to finish writing the file
sudo ln -s /etc/nginx/sites-available/jenkins /etc/nginx/sites-enabled/
sudo service nginx restart
Copy link

ghost commented Mar 12, 2017

Remove or update this uber obsolete information from internet, you are confusing people . . . what is described in the instructions above do not apply in a brand-new Nginx installation.

[root@jenkins nginx]# ll
total 88
drwxr-xr-x. 4 root root 4096 Mar 12 15:30 .
drwxr-xr-x. 80 root root 8192 Mar 12 15:25 ..
-rw-r--r--. 1 root root 1220 Mar 12 15:26 cert.crt
-rw-r--r--. 1 root root 1704 Mar 12 15:26 cert.key
drwxr-xr-x. 2 root root 38 Mar 11 23:22 conf.d
drwxr-xr-x. 2 root root 6 Mar 12 15:20 default.d
-rw-r--r--. 1 root root 1077 Oct 31 12:39 fastcgi.conf
-rw-r--r--. 1 root root 1077 Oct 31 12:39 fastcgi.conf.default
-rw-r--r--. 1 root root 1007 Oct 31 12:39 fastcgi_params
-rw-r--r--. 1 root root 1007 Oct 31 12:39 fastcgi_params.default
-rw-r--r--. 1 root root 2837 Oct 31 12:39 koi-utf
-rw-r--r--. 1 root root 2223 Oct 31 12:39 koi-win
-rw-r--r--. 1 root root 3957 Oct 31 12:39 mime.types
-rw-r--r--. 1 root root 3957 Oct 31 12:39 mime.types.default
-rw-r--r--. 1 root root 2467 Mar 11 23:27 nginx.conf
-rw-r--r--. 1 root root 2656 Oct 31 12:39 nginx.conf.default
-rw-r--r--. 1 root root 2467 Mar 11 23:23 nginx.conf_ORIGINALE
-rw-r--r--. 1 root root 636 Oct 31 12:39 scgi_params
-rw-r--r--. 1 root root 636 Oct 31 12:39 scgi_params.default
-rw-r--r--. 1 root root 664 Oct 31 12:39 uwsgi_params
-rw-r--r--. 1 root root 664 Oct 31 12:39 uwsgi_params.default
-rw-r--r--. 1 root root 3610 Oct 31 12:39 win-utf
[root@jenkins nginx]#

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment