#this is the jenkins web root directory (mentioned in the /etc/default/jenkins file) root /opt/jenkins/war/;
#access_log /var/log/nginx/jenkins/access.log; #error_log /var/log/nginx/jenkins/error.log; ignore_invalid_headersoff; #pass through headers from Jenkins which are considered invalid by Nginx server.
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}\/(.*)" /$1last; }
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 (.*) /$1last; break; } sendfileon; } location / { sendfileoff; proxy_pass http://jenkins; proxy_redirect default; proxy_http_version1.1;