certbot-scrypts/from_tyler/mksite.sh

68 lines
1.7 KiB
Bash

#!/bin/bash
set -e;
domain=$1;
echo "Creating local site $domain";
mkdir -p "/var/log/apache2/$domain";
sudo mkdir -p "/var/www/$domain/web";
cat > /etc/apache2/sites-enabled/$domain.conf <<_EOF_
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName $domain
ProxyPass /.well-known/acme-challenge/ http://127.0.0.1:8082/.well-known/acme-challenge/
# RewriteEngine On
#
# RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge.*
# RewriteRule ^(.*)$ https://%{HTTP_HOST} [R=301,L]
DocumentRoot /var/www/$domain/web
<Directory /var/www/$domain/web>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/$domain/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/$domain/access.log combined
</VirtualHost>
#<VirtualHost *:443>
# ServerAdmin webmaster@localhost
# ServerName $domain
#
# DocumentRoot /var/www/$domain/web
# <Directory /var/www/$domain/web>
# Options Indexes FollowSymLinks MultiViews
# AllowOverride All
# Order allow,deny
# allow from all
# </Directory>
#
# ErrorLog /var/log/apache2/$domain/error.log
#
# # Possible values include: debug, info, notice, warn, error, crit,
# # alert, emerg.
# LogLevel warn
#
# Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
#
# CustomLog /var/log/apache2/$domain/access.log combined
#
# SSLEngine on
# SSLCertificateFile /etc/apache2/ssl/$domain/$domain.crt
# SSLCertificateKeyFile /etc/apache2/ssl/$domain/$domain.key
# SSLCertificateChainFile /etc/apache2/ssl/$domain/lets-encrypt-x3-cross-signed.pem
#</VirtualHost>
_EOF_
echo "Site set up, just restart apache when you are ready to initialize";