summaryrefslogtreecommitdiff
path: root/kvmd/configs/nginx/nginx.conf.example
blob: cd30f5722419c6bc19d23300d6f22b47dfd992f6 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
user http;
worker_processes 4;

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

events {
	worker_connections 64;
	use epoll;
}

http {
	access_log off;

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

	sendfile on;
	keepalive_timeout 10;

	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;

	server {
		listen 80;
		server_name localhost;
		return 301 https://$host$request_uri;
	}

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

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

	server {
		listen 443 ssl http2;
		server_name localhost;

		ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
		ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
		ssl_certificate ssl/server.crt;
		ssl_certificate_key ssl/server.key;

		add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

		location / {
			root /usr/share/kvmd/web;
			index index.html;
		}

		location /kvmd/ws {
			rewrite /kvmd/ws /ws break;
			proxy_pass http://kvmd;
			proxy_set_header Upgrade $http_upgrade;
			proxy_set_header Connection "upgrade";
			proxy_connect_timeout 7d;
			proxy_send_timeout 7d;
			proxy_read_timeout 7d;
		}

		location /kvmd/msd/write {
			rewrite /kvmd/msd/write /msd/write break;
			proxy_pass http://kvmd;
			limit_rate 6250k;
			limit_rate_after 50k;
			client_max_body_size 0;
			proxy_request_buffering off;
		}

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

		location /streamer {
			rewrite /streamer/?(.*) /$1 break;
			proxy_pass http://mjpg_streamer;
			proxy_buffering off;
			proxy_ignore_headers X-Accel-Buffering;
		}
	}
}