Files
hartman-server/script-install-reverse-proxy
2021-10-21 15:53:07 -04:00

34 lines
632 B
Bash

#!/usr/bin/env bash
# Adds a reverse proxy for local system services
# Copyright 2021 Bryan C. Roessler
[[ -f functions ]] && . functions || exit 1
is_root
dnf install -y nginx || exit $?
cat <<- 'EOF' > /etc/nginx/conf.d/hartmanlab.conf
server {
listen 80;
server_name localhost.cockpit;
location / {
proxy_pass http://localhost:9090/;
proxy_redirect http://localhost:9090/;
}
}
server {
listen 80;
server_name localhost.robot;
location / {
proxy_pass http://localhost:8888/;
proxy_redirect http://localhost:8888/;
}
}
EOF
systemctl enable --now nginx
exit $?