Created
July 19, 2023 07:25
-
-
Save GamePlayer-8/e7a0ae11f3ba06f67433f61be11c53bd to your computer and use it in GitHub Desktop.
nginx_motion.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set $motionweb <MOTION WEBPORT>; | |
set $motionstream <MOTION STREAMPORT>; | |
set $motionip <MOTION IP>; | |
location /motion/ { | |
add_header Access-Control-Allow-Origin *; | |
proxy_pass http://$motionip:$motionweb/; | |
proxy_set_header Host $host; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Accept-Encoding ""; | |
proxy_pass_request_headers on; | |
proxy_redirect http://$host:$motionstream/ /motion/streams/0/stream/; | |
sub_filter 'http://' 'https://'; | |
sub_filter ':$motionstream' ':443/motion/streams'; | |
sub_filter '"/' '"/motion/'; | |
sub_filter "'/" "'/motion/"; | |
sub_filter 'url(/' 'url(/motion/'; | |
sub_filter 'url("/' 'url("/motion'; | |
sub_filter "url('/" "url('/motion"; | |
sub_filter "$host/" "$host/motion/"; | |
sub_filter_types *; | |
sub_filter_once off; | |
sub_filter_last_modified on; | |
} | |
location ~ /motion/streams/(?<motionpath>.*) { | |
proxy_set_header Connection "keep-alive"; | |
proxy_store off; | |
add_header Access-Control-Allow-Origin *; | |
proxy_pass http://$motionip:$motionstream/$motionpath$is_args$args; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Accept-Encoding ""; | |
proxy_pass_request_headers on; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment