mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
22 lines
488 B
Bash
Executable File
22 lines
488 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
APP="$1"; PORT="$2"
|
|
|
|
if [[ -f "$HOME/VHOST" ]]; then
|
|
hostname="${APP/\//-}.$(< "$HOME/VHOST")"
|
|
cat<<EOF > $HOME/$APP/nginx.conf
|
|
upstream $APP { server 127.0.0.1:$PORT; }
|
|
server {
|
|
listen 80;
|
|
server_name $hostname;
|
|
location / {
|
|
proxy_pass http://$APP;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
}
|
|
}
|
|
EOF
|
|
nc -U $HOME/reload-nginx
|
|
echo "$hostname" > "$HOME/$APP/VHOST"
|
|
fi |