diff options
author | Devaev Maxim <[email protected]> | 2019-10-27 19:15:13 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2019-10-27 19:15:13 +0300 |
commit | da952424ef4f4e4c3b5b33d39be564bc888d78e6 (patch) | |
tree | c1bfaf52f4caabd28d24651a89194bda8576aea7 | |
parent | b8abf790f2cd5044be20b060801cbb8d82ad17f1 (diff) |
split nginx.conf
-rw-r--r-- | PKGBUILD | 2 | ||||
-rw-r--r-- | configs/nginx/kvmd.ctx-http.conf | 7 | ||||
-rw-r--r-- | configs/nginx/kvmd.ctx-server.conf | 95 | ||||
-rw-r--r-- | configs/nginx/nginx.conf | 105 |
4 files changed, 105 insertions, 104 deletions
@@ -54,7 +54,7 @@ md5sums=(SKIP) backup=( etc/kvmd/{override,logging,auth,meta}.yaml etc/kvmd/{ht,ipmi}passwd - etc/kvmd/nginx/{loc-{login,nocache,proxy,websocket},mime-types,ssl,nginx}.conf + etc/kvmd/nginx/{kvmd.ctx-{http,server},loc-{login,nocache,proxy,websocket},mime-types,ssl,nginx}.conf ) diff --git a/configs/nginx/kvmd.ctx-http.conf b/configs/nginx/kvmd.ctx-http.conf new file mode 100644 index 00000000..ceb68ef8 --- /dev/null +++ b/configs/nginx/kvmd.ctx-http.conf @@ -0,0 +1,7 @@ +upstream kvmd { + server unix:/run/kvmd/kvmd.sock fail_timeout=0s max_fails=0; +} + +upstream ustreamer { + server unix:/run/kvmd/ustreamer.sock fail_timeout=0s max_fails=0; +} diff --git a/configs/nginx/kvmd.ctx-server.conf b/configs/nginx/kvmd.ctx-server.conf new file mode 100644 index 00000000..86f3ee47 --- /dev/null +++ b/configs/nginx/kvmd.ctx-server.conf @@ -0,0 +1,95 @@ +absolute_redirect off; + +index index.html; + +auth_request /auth_check; + +location = /auth_check { + internal; + proxy_pass http://kvmd/auth/check; + proxy_pass_request_body off; + proxy_set_header Content-Length ""; + auth_request off; +} + +location / { + root /usr/share/kvmd/web; + include /etc/kvmd/nginx/loc-login.conf; + include /etc/kvmd/nginx/loc-nocache.conf; +} + +location @login { + return 302 /login; +} + +location /login { + root /usr/share/kvmd/web; + auth_request off; +} + +location /share { + root /usr/share/kvmd/web; + auth_request off; +} + +location = /favicon.ico { + alias /usr/share/kvmd/web/favicon.ico; + auth_request off; +} + +location = /robots.txt { + alias /usr/share/kvmd/web/robots.txt; + auth_request off; +} + +location /api/ws { + rewrite ^/api/ws$ /ws break; + rewrite ^/api/ws\?(.*)$ /ws?$1 break; + proxy_pass http://kvmd; + include /etc/kvmd/nginx/loc-proxy.conf; + include /etc/kvmd/nginx/loc-websocket.conf; + auth_request off; +} + +location /api/msd/write { + rewrite ^/api/msd/write$ /msd/write break; + rewrite ^/api/msd/write\?(.*)$ /msd/write?$1 break; + proxy_pass http://kvmd; + include /etc/kvmd/nginx/loc-proxy.conf; + limit_rate 6250k; + limit_rate_after 50k; + client_max_body_size 0; + proxy_request_buffering off; + auth_request off; +} + +location /api/log { + rewrite ^/api/log$ /log break; + rewrite ^/api/log\?(.*)$ /log?$1 break; + proxy_pass http://kvmd; + include /etc/kvmd/nginx/loc-proxy.conf; + proxy_read_timeout 7d; + postpone_output 0; + proxy_buffering off; + proxy_ignore_headers X-Accel-Buffering; + auth_request off; +} + +location /api { + rewrite ^/api$ / break; + rewrite ^/api/(.*)$ /$1 break; + proxy_pass http://kvmd; + include /etc/kvmd/nginx/loc-proxy.conf; + auth_request off; +} + +location /streamer { + rewrite ^/streamer$ / break; + rewrite ^/streamer\?(.*)$ ?$1 break; + rewrite ^/streamer/(.*)$ /$1 break; + proxy_pass http://ustreamer; + include /etc/kvmd/nginx/loc-proxy.conf; + postpone_output 0; + proxy_buffering off; + proxy_ignore_headers X-Accel-Buffering; +} diff --git a/configs/nginx/nginx.conf b/configs/nginx/nginx.conf index 9984d686..a64a0f71 100644 --- a/configs/nginx/nginx.conf +++ b/configs/nginx/nginx.conf @@ -18,9 +18,6 @@ http { default_type application/octet-stream; charset utf-8; - absolute_redirect off; - index index.html; - sendfile on; tcp_nodelay on; tcp_nopush on; @@ -33,14 +30,7 @@ http { scgi_temp_path /tmp/kvmd-nginx.scgi_temp; uwsgi_temp_path /tmp/kvmd-nginx.uwsgi_temp; - upstream kvmd { - server unix:/run/kvmd/kvmd.sock fail_timeout=0s max_fails=0; - } - - upstream ustreamer { - server unix:/run/kvmd/ustreamer.sock fail_timeout=0s max_fails=0; - } - + include /etc/kvmd/nginx/kvmd.ctx-http.conf; include /usr/share/kvmd/extras/*/nginx.ctx-http.conf; #PROD server { @@ -54,98 +44,7 @@ http { server_name localhost; #PROD include /etc/kvmd/nginx/ssl.conf; - auth_request /auth_check; - - location = /auth_check { - internal; - proxy_pass http://kvmd/auth/check; - proxy_pass_request_body off; - proxy_set_header Content-Length ""; - auth_request off; - } - - location / { - root /usr/share/kvmd/web; - include /etc/kvmd/nginx/loc-login.conf; - include /etc/kvmd/nginx/loc-nocache.conf; - } - - location @login { - return 302 /login; - } - - location /login { - root /usr/share/kvmd/web; - auth_request off; - } - - location /share { - root /usr/share/kvmd/web; - auth_request off; - } - - location = /favicon.ico { - alias /usr/share/kvmd/web/favicon.ico; - auth_request off; - } - - location = /robots.txt { - alias /usr/share/kvmd/web/robots.txt; - auth_request off; - } - - location /api/ws { - rewrite ^/api/ws$ /ws break; - rewrite ^/api/ws\?(.*)$ /ws?$1 break; - proxy_pass http://kvmd; - include /etc/kvmd/nginx/loc-proxy.conf; - include /etc/kvmd/nginx/loc-websocket.conf; - auth_request off; - } - - location /api/msd/write { - rewrite ^/api/msd/write$ /msd/write break; - rewrite ^/api/msd/write\?(.*)$ /msd/write?$1 break; - proxy_pass http://kvmd; - include /etc/kvmd/nginx/loc-proxy.conf; - limit_rate 6250k; - limit_rate_after 50k; - client_max_body_size 0; - proxy_request_buffering off; - auth_request off; - } - - location /api/log { - rewrite ^/api/log$ /log break; - rewrite ^/api/log\?(.*)$ /log?$1 break; - proxy_pass http://kvmd; - include /etc/kvmd/nginx/loc-proxy.conf; - proxy_read_timeout 7d; - postpone_output 0; - proxy_buffering off; - proxy_ignore_headers X-Accel-Buffering; - auth_request off; - } - - location /api { - rewrite ^/api$ / break; - rewrite ^/api/(.*)$ /$1 break; - proxy_pass http://kvmd; - include /etc/kvmd/nginx/loc-proxy.conf; - auth_request off; - } - - location /streamer { - rewrite ^/streamer$ / break; - rewrite ^/streamer\?(.*)$ ?$1 break; - rewrite ^/streamer/(.*)$ /$1 break; - proxy_pass http://ustreamer; - include /etc/kvmd/nginx/loc-proxy.conf; - postpone_output 0; - proxy_buffering off; - proxy_ignore_headers X-Accel-Buffering; - } - + include /etc/kvmd/nginx/kvmd.ctx-server.conf; include /usr/share/kvmd/extras/*/nginx.ctx-server.conf; } } |