1
0
mirror of https://github.com/fcwu/docker-ubuntu-vnc-desktop synced 2026-08-05 16:12:41 +02:00

feat: support SSL and http base access authentication

This commit is contained in:
Doro Wu
2018-03-16 13:14:11 +08:00
parent 10f4af2fab
commit 44c1f26170
5 changed files with 76 additions and 16 deletions
+9 -1
View File
@@ -1,6 +1,14 @@
server {
listen 80 default_server;
#listen [::]:6080 default_server ipv6only=on;
# listen [::]:80 default_server ipv6only=on;
#_SSL_PORT_#listen 443 ssl default_server;
#_SSL_PORT_#listen [::]:443 ssl default_server ipv6only=on;
#_SSL_PORT_#ssl_certificate /etc/nginx/ssl/nginx.crt;
#_SSL_PORT_#ssl_certificate_key /etc/nginx/ssl/nginx.key;
#_HTTP_PASSWORD_#auth_basic "Private Property";
#_HTTP_PASSWORD_#auth_basic_user_file /etc/nginx/.htpasswd;
root /usr/share/nginx/html;
index index.html index.htm;
+20 -4
View File
@@ -15,9 +15,10 @@ fi
USER=${USER:-root}
HOME=/root
if [ "$USER" != "root" ]; then
echo "* enable custom user: $USER"
useradd --create-home --shell /bin/bash --user-group --groups adm,sudo $USER
if [ -z "$PASSWORD" ]; then
echo set default password to \"ubuntu\"
echo " set default password to \"ubuntu\""
PASSWORD=ubuntu
fi
HOME=/home/$USER
@@ -32,10 +33,25 @@ mkdir -p $HOME/.config/pcmanfm/LXDE/
ln -sf /usr/local/share/doro-lxde-wallpapers/desktop-items-0.conf $HOME/.config/pcmanfm/LXDE/
chown -R $USER:$USER $HOME
# nginx
sed -i 's#worker_processes .*#worker_processes 1;#' /etc/nginx/nginx.conf
# nginx workers
sed -i 's|worker_processes .*|worker_processes 1;|' /etc/nginx/nginx.conf
# nginx ssl
if [ -n "$SSL_PORT" ] && [ -e "/etc/nginx/ssl/nginx.key" ]; then
echo "* enable SSL"
sed -i 's|#_SSL_PORT_#\(.*\)443\(.*\)|\1'$SSL_PORT'\2|' /etc/nginx/sites-enabled/default
sed -i 's|#_SSL_PORT_#||' /etc/nginx/sites-enabled/default
fi
# nginx http base authentication
if [ -n "$HTTP_PASSWORD" ]; then
echo "* enable HTTP base authentication"
htpasswd -bc /etc/nginx/.htpasswd $USER $HTTP_PASSWORD
sed -i 's|#_HTTP_PASSWORD_#||' /etc/nginx/sites-enabled/default
fi
# clearup
PASSWORD=
HTTP_PASSWORD=
exec /bin/tini -- /usr/bin/supervisord -n
exec /bin/tini -- /usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf