summaryrefslogtreecommitdiff
path: root/os/kvm/nginx.conf
blob: a236b08541535149550fb8b7d50f3c8c794c5d2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
user http;
worker_processes 4;

# error_log /tmp/nginx.error.log;
error_log /dev/null crit;

events {
	worker_connections 64;
	use epoll;
}

http {
	include mime.types;
	default_type application/octet-stream;
	charset utf-8;

	sendfile on;
	keepalive_timeout 10;
	# gzip on;

	upstream kvm_ws {
		server localhost:8081 fail_timeout=0s max_fails=0;
	}

	upstream mjpg_streamer {
		server localhost:8082 fail_timeout=0s max_fails=0;
	}

	server {
		# access_log /tmp/nginx.access.log;
		access_log off;

		listen 80;
		server_name localhost;

		client_body_temp_path /tmp/nginx.client_body_temp;
		fastcgi_temp_path     /tmp/nginx.fastcgi_temp;
		proxy_temp_path       /tmp/nginx.proxy_temp;
		scgi_temp_path        /tmp/nginx.scgi_temp;
		uwsgi_temp_path       /tmp/nginx.uwsgi_temp;

		location / {
			root /srv/http;
			index index.html;
		}

		location /kvm/ws {
			rewrite /kvm/ws /ws break;
			proxy_pass http://kvm_ws;
			proxy_set_header Upgrade $http_upgrade;
			proxy_set_header Connection "upgrade";
		}

		location /video {
			rewrite /video/?(.*) /$1 break;
			proxy_pass http://mjpg_streamer;
		}
	}
}