Samuli Silvius | f5534d8 | 2018-12-21 16:08:09 +0200 | [diff] [blame] | 1 | worker_processes 2; |
| 2 | |
| 3 | events { |
| 4 | worker_connections 1024; |
| 5 | } |
| 6 | |
| 7 | http { |
| 8 | error_log /var/log/nginx/error.log debug; |
| 9 | access_log /var/log/nginx/access.log; |
| 10 | |
| 11 | proxy_intercept_errors on; |
| 12 | proxy_send_timeout 120; |
| 13 | proxy_read_timeout 300; |
| 14 | |
| 15 | upstream nexus { |
| 16 | server nexus:8081; |
| 17 | } |
| 18 | |
| 19 | upstream registry { |
| 20 | server nexus:8082; |
| 21 | } |
| 22 | |
| 23 | # http simulations |
| 24 | server { |
| 25 | listen 80; |
| 26 | listen 443 ssl; |
| 27 | server_name _; |
| 28 | ssl_certificate /etc/nginx/certs/nexus_server.crt; |
| 29 | ssl_certificate_key /etc/nginx/certs/nexus_server.key; |
| 30 | |
| 31 | keepalive_timeout 5 5; |
| 32 | |
| 33 | location / { |
| 34 | root /srv/http/$host; |
| 35 | index index.html; |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | # nexus simulations |
| 40 | server { |
| 41 | listen 80; |
| 42 | listen 443 ssl; |
| 43 | server_name nexus.student12 gcr.io registry-1.docker.io docker.io registry.npmjs.org nexus3.onap.org docker.elastic.co registry.hub.docker.com; |
| 44 | ssl_certificate /etc/nginx/certs/nexus_server.crt; |
| 45 | ssl_certificate_key /etc/nginx/certs/nexus_server.key; |
| 46 | |
| 47 | keepalive_timeout 5 5; |
| 48 | proxy_buffering off; |
| 49 | |
| 50 | # allow large uploads |
| 51 | client_max_body_size 3G; |
| 52 | |
| 53 | location /maven2 { |
| 54 | rewrite /maven2/(.*) /repository/maven2/$1 break; |
| 55 | # redirect to docker registry |
| 56 | proxy_pass http://nexus; |
| 57 | proxy_set_header Host $host; |
| 58 | proxy_set_header X-Real-IP $remote_addr; |
| 59 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 60 | } |
| 61 | |
| 62 | location / { |
| 63 | # redirect to docker registry |
| 64 | if ($http_user_agent ~ docker ) { |
| 65 | proxy_pass http://registry; |
| 66 | } |
| 67 | proxy_pass http://nexus; |
| 68 | proxy_set_header Host $host; |
| 69 | proxy_set_header X-Real-IP $remote_addr; |
| 70 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | # git simulations |
| 75 | server { |
| 76 | listen 80; |
| 77 | listen 443 ssl; |
| 78 | server_name gerrit.onap.org git.rancher.io github.com; |
| 79 | ssl_certificate /etc/nginx/certs/nexus_server.crt; |
| 80 | ssl_certificate_key /etc/nginx/certs/nexus_server.key; |
| 81 | |
| 82 | keepalive_timeout 5 5; |
| 83 | proxy_buffering off; |
| 84 | |
| 85 | location / { |
| 86 | try_files $uri $uri/ @git; |
| 87 | } |
| 88 | |
| 89 | location @git { |
| 90 | |
| 91 | # Set chunks to unlimited, as the body's can be huge |
| 92 | client_max_body_size 0; |
| 93 | |
| 94 | fastcgi_param SCRIPT_FILENAME /usr/libexec/git-core/git-http-backend; |
| 95 | fastcgi_param QUERY_STRING $args; |
| 96 | fastcgi_param HTTP_HOST $server_name; |
| 97 | fastcgi_param PATH_INFO $uri; |
| 98 | |
| 99 | include fastcgi_params; |
| 100 | |
| 101 | fastcgi_param GIT_HTTP_EXPORT_ALL ""; |
| 102 | fastcgi_param GIT_PROJECT_ROOT /srv/git/$host/; |
| 103 | |
| 104 | # Forward REMOTE_USER as we want to know when we are authenticated |
| 105 | fastcgi_param REMOTE_USER $remote_user; |
| 106 | |
| 107 | fastcgi_pass unix:/var/run/fcgiwrap.socket; |
| 108 | } |
| 109 | } |
| 110 | } |