From 3312e8e2a9a773bfcf5928ecb85481dc53204fd8 Mon Sep 17 00:00:00 2001 From: Stephen Cochrane Date: Thu, 15 Oct 2020 09:44:10 +0200 Subject: [PATCH] Added units --- nginxd | 10 +++++++--- units/blog | 12 ++++++++++++ units/git | 12 ++++++++++++ units/irc | 12 ++++++++++++ units/proj | 12 ++++++++++++ units/wiki | 12 ++++++++++++ 6 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 units/blog create mode 100644 units/git create mode 100644 units/irc create mode 100644 units/proj create mode 100644 units/wiki diff --git a/nginxd b/nginxd index 3993af6..8adf5ee 100755 --- a/nginxd +++ b/nginxd @@ -55,8 +55,12 @@ unitsd=${unitsd:="./units"} # Check that a valid unit was given. [[ ! " ${units[@]} " =~ " ${unit} " ]] && error "The unit <$unit> does not exist." 1 \ - || echo "Unit <$unit> found!" + || echo "Unit <$unit> is supported!" + +# Check if we are disabeling, that we have a replacement unit +[ $oper == "d" ] && [[ ! -f "$unitsd/d$unit" ]] && error "Cannot find replacement unit for <$unit>" 1 +[ $oper == "e" ] && [[ ! -f "$unitsd/$unit" ]] && error "Cannot find unit file for <$unit>" 1 # Everything is valid, start setting up. -cp $unitsd/* /etc/nginx/sites-available/ -# TODO: Setup links, and delete links if needed +#cp $unitsd/* /etc/nginx/sites-available/ +echo TODO: Setup links, and delete links if needed diff --git a/units/blog b/units/blog new file mode 100644 index 0000000..f0964f7 --- /dev/null +++ b/units/blog @@ -0,0 +1,12 @@ +server { + listen 80; + server_name blog.skiqqy.xyz; + + location / { + proxy_pass http://localhost:84; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } +} diff --git a/units/git b/units/git new file mode 100644 index 0000000..6a5bcbc --- /dev/null +++ b/units/git @@ -0,0 +1,12 @@ +server { + listen 80; + server_name git.skiqqy.xyz; + + location / { + proxy_pass http://localhost:83; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } +} diff --git a/units/irc b/units/irc new file mode 100644 index 0000000..baa6a7e --- /dev/null +++ b/units/irc @@ -0,0 +1,12 @@ +server { + listen 80; + server_name irc.skiqqy.xyz; + + location / { + proxy_pass http://localhost:81; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } +} diff --git a/units/proj b/units/proj new file mode 100644 index 0000000..a8382d1 --- /dev/null +++ b/units/proj @@ -0,0 +1,12 @@ +server { + listen 80; + server_name proj.skiqqy.xyz; + + location / { + proxy_pass http://localhost:82; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } +} diff --git a/units/wiki b/units/wiki new file mode 100644 index 0000000..d885e3b --- /dev/null +++ b/units/wiki @@ -0,0 +1,12 @@ +server { + listen 80; + server_name wiki.skiqqy.xyz; + + location / { + proxy_pass http://localhost:85; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } +}