Last active
June 15, 2019 15:59
-
-
Save DusterTheFirst/7bbed82f6421df409939f2c1577d7a8d to your computer and use it in GitHub Desktop.
Create VHOSTS for lighttpd from a simple json file using only `include_shell "/usr/share/lighttpd/createLocalProxies.sh"`. So easy, elliot can use it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Place in /usr/share/lighttpd/ | |
FILENAME="/etc/lighttpd/localProxies.json" | |
cat $FILENAME\ | |
| jq 'to_entries[] | .key as $host | .value | to_entries[] | {host: "\(.key).\($ | |
| jq -r ' | |
"else $HTTP[\"host\"] == \"\(.host)\" { | |
proxy.server = (\"\"=>(( | |
\"host\"=>\"127.0.0.1\", | |
\"port\"=>\(.port) | |
))) | |
}"'\ | |
| sed '1{s/^else //}; :a;N;$!ba;s/}\n/} /g' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place in /etc/lighttpd/ | |
{ | |
"elliotsworld.tech": { | |
"mcadmin": 8080, | |
"tf": 4299, | |
"amp": 8081, | |
"mc0": 8083, | |
"mc1": 8082, | |
"mc2": 8084 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment