diff --git a/conf/nginx.conf b/conf/nginx.conf index 2d096c8b8..792b58faf 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -26,9 +26,7 @@ http { server { include proxy-protocol.conf; - set $ratelimit 1; - - include server-base.conf; + include proxy-server-base.conf; listen 8443 default proxy_protocol; diff --git a/conf/proxy-server-base.conf b/conf/proxy-server-base.conf new file mode 100644 index 000000000..d1c3ab476 --- /dev/null +++ b/conf/proxy-server-base.conf @@ -0,0 +1,79 @@ +# vim: ft=nginx + +client_body_temp_path /var/log/nginx/client_body 1 2; +server_name _; + +keepalive_timeout 5; + +if ($args ~ "_escaped_fragment_") { + rewrite ^ /snapshot$uri; +} + +proxy_set_header X-Forwarded-For $proxy_protocol_addr; +proxy_set_header X-Forwarded-Proto $scheme; +proxy_set_header Host $http_host; +proxy_redirect off; + +proxy_set_header Transfer-Encoding $http_transfer_encoding; + +location / { + proxy_pass http://web_app_server; + + limit_req zone=webapp burst=10 nodelay; +} + +location /realtime { + proxy_pass http://web_app_server; + proxy_buffering off; + proxy_request_buffering off; +} + +location /v1/ { + proxy_buffering off; + + proxy_request_buffering off; + + proxy_pass http://registry_app_server; + proxy_read_timeout 2000; + proxy_temp_path /var/log/nginx/proxy_temp 1 2; + + client_max_body_size 20G; + + limit_req zone=api burst=5 nodelay; +} + +location /c1/ { + proxy_buffering off; + + proxy_request_buffering off; + + proxy_pass http://verbs_app_server; + proxy_read_timeout 2000; + proxy_temp_path /var/log/nginx/proxy_temp 1 2; + + limit_req zone=api burst=5 nodelay; +} + +location /static/ { + # checks for static file, if not found proxy to app + alias /static/; +} + +location /v1/_ping { + add_header Content-Type text/plain; + add_header X-Docker-Registry-Version 0.6.0; + add_header X-Docker-Registry-Standalone 0; + return 200 'true'; +} + +location ~ ^/b1/controller(/?)(.*) { + proxy_pass http://build_manager_controller_server/$2; + proxy_read_timeout 2000; +} + +location ~ ^/b1/socket(/?)(.*) { + proxy_pass http://build_manager_websocket_server/$2; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; +} diff --git a/conf/server-base.conf b/conf/server-base.conf index ac671e95d..d5b211c52 100644 --- a/conf/server-base.conf +++ b/conf/server-base.conf @@ -21,8 +21,6 @@ proxy_set_header Transfer-Encoding $http_transfer_encoding; location / { proxy_pass http://web_app_server; - - #limit_req zone=webapp burst=10 nodelay; } location /realtime { @@ -41,10 +39,6 @@ location /v1/ { proxy_temp_path /var/log/nginx/proxy_temp 1 2; client_max_body_size 20G; - - if ($ratelimit) { - limit_req zone=api burst=5 nodelay; - } } location /c1/ { @@ -55,10 +49,6 @@ location /c1/ { proxy_pass http://verbs_app_server; proxy_read_timeout 2000; proxy_temp_path /var/log/nginx/proxy_temp 1 2; - - if ($ratelimit) { - limit_req zone=api burst=5 nodelay; - } } location /static/ {