mirror of
https://git.myvelabs.com/novnc/archlinux.git
synced 2025-12-17 21:26:20 +00:00
46 lines
1 KiB
Bash
Executable file
46 lines
1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Reformat proxy path
|
|
if [[ ${MYVNC_PROXYPATH} == "/" ]]
|
|
then
|
|
unset _MYVNC_PROXYPATH
|
|
elif [ ${MYVNC_PROXYPATH} ]
|
|
then
|
|
_MYVNC_PROXYPATH=$(echo ${MYVNC_PROXYPATH} | sed "s|^/*||g;s|/*$||g;s|/*/|/|g;s|^|/|")
|
|
fi
|
|
|
|
# Add novnc virtual proxy conf
|
|
cat >/app/nginx/novnc.conf <<- novnc
|
|
upstream vnc_proxy {
|
|
server 127.0.0.1:6080;
|
|
}
|
|
|
|
server {
|
|
listen 6900;
|
|
|
|
location ${_MYVNC_PROXYPATH}/websockify {
|
|
proxy_http_version 1.1;
|
|
proxy_pass http://vnc_proxy/;
|
|
proxy_set_header Upgrade \$http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
# VNC connection timeout
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
|
|
# Disable cache
|
|
proxy_buffering off;
|
|
}
|
|
|
|
location ${_MYVNC_PROXYPATH}/ {
|
|
index vnc.html;
|
|
alias /app/novnc/;
|
|
try_files \$uri \$uri/ /vnc.html;
|
|
|
|
# In the location block related to noVNC
|
|
add_header Cache-Control no-cache;
|
|
}
|
|
}
|
|
novnc
|
|
|
|
# Start nginx
|
|
sudo /usr/bin/nginx -g "daemon off;" &
|