Creates a quick and direct config for OpenBSD's httpd
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
httpd_config/httpd_conf.sh

39 lines
841 B

#/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