Added main file and created readme

master
Sean Howard 4 years ago
parent 9a0c73a8e2
commit afd4379eb9
  1. 14
      README.md
  2. 39
      httpd_conf.sh

@ -1,3 +1,15 @@
# httpd_config
Creates a quick and direct config for OpenBSD's httpd
Creates a quick and direct config for OpenBSD's httpd
Can be run via:
httpd_conf.sh [fqdn] [/path/to/root] [php]
The php variable adds configs for passing to php-fpm.sock and sets the directory index to index.php
The root must be relative to the chroot (typically /htdocs).
I recently used this for:
httpd_conf.sh jackpoint.obscuritus.ca /htdocs/mediawiki php
To generate a config for my mediawiki install for the Jackpoint Wiki I run for a shadowrun game

@ -0,0 +1,39 @@
#/bin/sh
tld=$1
dir=$2
php=$3
echo "server "$tld" {"
echo ' listen on egress port 80'
echo ' location "/.well-known/acme-challenge/*" {'
echo ' root "/acme"'
echo ' request strip 2'
echo ' }'
echo ' location * {'
echo ' block return 302 "https://$HTTP_HOST$REQUEST_URI"'
echo ' }'
echo '}'
echo ''
echo "server "$tld" {"
echo ' listen on egress tls port 443'
echo ' tls {'
echo " certificate \"/etc/ssl/$tld.fullchain.pem\""
echo " key \"/etc/ssl/private/$tld.key\""
echo ' }'
echo ' location "/pub/*" {'
echo ' directory auto index'
echo ' }'
echo ' location "/.well-known/acme-challenge/*" {'
echo ' root "/acme"'
echo ' request strip 2'
echo ' }'
if [ -n "$php" ]
then
echo ' location "/*.php*" {'
echo ' fastcgi socket "/run/php-fpm.sock"'
echo ' }'
echo ' directory index "index.php"'
fi
echo " root \"$dir\""
echo '}'
echo
Loading…
Cancel
Save