server {
  listen 80;
  server_name {{ jenkins_server_name }};

  location / {
    proxy_pass              http://localhost:{{ jenkins_port }};

    # Rewrite HTTPS requests from WAN to HTTP requests on LAN
    proxy_redirect http:// https://;

    # The following settings from https://wiki.jenkins-ci.org/display/JENKINS/Running+Hudson+behind+Nginx
    sendfile 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_connect_timeout   150;
    proxy_send_timeout      100;
    proxy_read_timeout      100;
    proxy_buffers           4 32k;
    client_max_body_size    8m;
    client_body_buffer_size 128k;

  }
}