LINUX.ORG.RU
решено ФорумAdmin

Nginx+ngx_http_proxy_module и mjpeg-streamer

 ,


0

1

Как перенаправить mjpeg-streamer'а c 127.0.0.1:8080 на 80 при помощи ngx_http_proxy_module?

Пока получилась вот такая конфигурация:

upstream "mjpg-streamer" {
	server 127.0.0.1:8080;
}

server {
	...

	location /webcam/ {
		proxy_pass http://mjpg-streamer/;
		include proxy.conf;
        }

	location /stream {
		proxy_pass "http://127.0.0.1:8080/?action=stream";
		include proxy.conf;
        }
}

настройки ngx_http_proxy_module в proxy.conf :

proxy_http_version 1.0;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;

Проверка...

[zudwa@localhost ~]$ curl http://192.168.0.192/webcam/ -I
Content-type: text/plain
Connection: close
Server: MJPG-Streamer/0.2
Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0
Pragma: no-cache
Expires: Mon, 3 Jan 2000 12:34:56 GMT

400: Not Found!
^C
[zudwa@localhost ~]$ curl http://192.168.0.192/stream -I
Content-type: text/plain
Connection: close
Server: MJPG-Streamer/0.2
Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0
Pragma: no-cache
Expires: Mon, 3 Jan 2000 12:34:56 GMT

400: Not Found!
^C
[zudwa@localhost ~]$ curl http://192.168.0.192:8080/?action=stream -I
HTTP/1.0 400 Bad Request
Content-type: text/plain
Connection: close
Server: MJPG-Streamer/0.2
Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0
Pragma: no-cache
Expires: Mon, 3 Jan 2000 12:34:56 GMT

[zudwa@localhost ~]$ curl http://192.168.0.192:8080/?action=snapshot
...!AVI1...xx..C.........

почему после прокси может теряться статус ответа HTTP ( HTTP/1.0 200 ОК )?


Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.