Skip to content

Instantly share code, notes, and snippets.

@coffeencoke
Created October 13, 2012 16:58

Revisions

  1. coffeencoke revised this gist Oct 13, 2012. 1 changed file with 19 additions and 0 deletions.
    19 changes: 19 additions & 0 deletions jenkins_centos_install.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    # Build Box

    ## Setup

    *these instructions are for a CentOS 6 server*

    ### Install Jenkins

    ```
    sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
    sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
    sudo yum install jenkins
    ```

    ### Start jenkins

    ```
    sudo service jenkins start
    ```
  2. coffeencoke created this gist Oct 13, 2012.
    55 changes: 55 additions & 0 deletions jenkins-nginx.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,55 @@
    server {
    listen 80; # Listen on port 80 for IPv4 requests

    server_name build.yourdomain.com;

    access_log /var/log/nginx/jenkins_access.log;
    error_log /var/log/nginx/jenkins_error.log;

    location ~ ^/static/[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]\/(.*)$ {
    #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][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]\/(.*)" /$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 off;

    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 / {
    root /var/cache/jenkins/war/;
    try_files $uri @jenkins;
    }
    }