Last active
December 11, 2020 10:56
-
-
Save kloudsamurai/97a9080802d154a6f31a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user nginx; | |
worker_processes auto; | |
error_log /var/log/nginx/error.log; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | |
'$status $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent" "$http_x_forwarded_for"'; | |
access_log /var/log/nginx/access.log main; | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay on; | |
#keepalive_timeout 0; | |
keepalive_timeout 65; | |
types_hash_max_size 2048; | |
gzip on; | |
server { | |
listen 443; | |
server_name jenkins.ajmoss.com; | |
ssl on; | |
ssl_certificate /opt/ssl/ssl.crt; | |
ssl_certificate_key /opt/ssl/ssl.key; | |
ssl_protocols TLSv1; | |
ssl_ciphers HIGH:!aNULL:!MD5; | |
ssl_prefer_server_ciphers on; | |
#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 "^/static/[0-9a-fA-F]{8}\/(.*)" /$1 last; | |
} | |
location /userContent { | |
root /var/lib/jenkins/; | |
if (!-f $request_filename) { | |
rewrite (.*) /$1 last; | |
break; | |
} | |
sendfile on; | |
} | |
location @jenkins { | |
sendfile off; | |
proxy_pass http://127.0.0.1:8080; | |
proxy_redirect http:// https://; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
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; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment