<VirtualHost *:441>
	ServerName sam.ucm.dev
	ServerAlias sam
	DocumentRoot "/var/www/sam.ucm.dev"
	ServerAdmin sam@ucm.dev
	ErrorLog logs/sam.ucm.dev-error_log
	CustomLog logs/sam.ucm.dev-access_log combined
	ScriptAlias /x/ /var/www/sam.ucm.dev/x/
	ScriptAlias /a/ /var/www/sam.ucm.dev/a/
	AddHandler cgi-script .cgi
	AddType text/plain .b .bb .bh .bbh .b1 .c .cc .h .sh .pl .py
	<Directory "/var/www/sam.ucm.dev">
		Options +Indexes
		Options +FollowSymLinks -SymLinksIfOwnerMatch
		Require all granted
		AllowOverride All
	</Directory>
	<Directory "/var/www/sam.ucm.dev/x">
		AllowOverride None
		Options +ExecCGI -MultiViews
		Options +FollowSymLinks -SymLinksIfOwnerMatch
		Require all granted
	</Directory>
	<Directory "/var/www/sam.ucm.dev/a">
		AllowOverride None
		Options +ExecCGI -MultiViews
		Options +FollowSymLinks -SymLinksIfOwnerMatch
		AuthName "Admin Only"
		AuthType Basic
		AuthUserFile /var/www/sam.ucm.dev/.htpasswd
		Require valid-user
	</Directory>
	<Directory "/var/www/sam.ucm.dev/logout">
		AllowOverride None
		authname "Admin Only"
		authtype basic
		authuserfile /var/www/sam.ucm.dev/logout/.htpasswd
		require valid-user
	</Directory>
	<Directory "/var/www/sam.ucm.dev/log">
		AllowOverride None
		authname "admin only"
		authtype basic
		authuserfile /var/www/sam.ucm.dev/.htpasswd
		require valid-user
	</Directory>
	<FilesMatch "^\.">
		order allow,deny
		deny from all
	</FilesMatch>

	ProxyRequests Off
	ProxyPreserveHost On
	ProxyVia Full
	<Proxy *>
		Require all granted
	</Proxy>
	<Location /ssh/>
		ProxyPass http://127.0.0.1:2222/ssh/
		ProxyPassReverse http://127.0.0.1:2222/ssh/
	</Location>
	<Location /miniflux/>
		ProxyPass http://127.0.0.1:8080/
		ProxyPassReverse http://127.0.0.1:8080/
	</Location>

	AddDefaultCharset utf-8
	RewriteEngine on
	RewriteRule ^/math/(.*)$ https://sam.try.coach/$1 [L]
	RewriteRule ^/d/(.*)$ https://dilbert.com/strips/comic/$1 [L]
	RewriteRule ^/c(15|30|60)$ https://calendly.com/ultracodemonkey/$1min [L]
#	RewriteRule ^/sam$ https://sam.aiki.info/ [L]
	SSLCertificateFile /etc/letsencrypt/live/ucm.dev/fullchain.pem
	SSLCertificateKeyFile /etc/letsencrypt/live/ucm.dev/privkey.pem
	Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
#<VirtualHost *:441>
#	ServerName www.ucm.dev
#	ServerAlias au.ucm.dev
#	DocumentRoot "/var/www/ucm"
#	ServerAdmin sam@ucm.dev
#	ErrorLog logs/ucm-error_log
#	CustomLog logs/ucm-access_log combined
#	RewriteEngine on
#	RewriteRule (.*) https://ucm.dev%{REQUEST_URI} [L]
#</VirtualHost>
<VirtualHost *:80>
	ServerName sam.ucm.dev
	ServerAlias sam
	DocumentRoot "/var/www/sam.ucm.dev"
	ServerAdmin sam@ucm.dev
	ErrorLog logs/sam.ucm.dev-error_log
	CustomLog logs/sam.ucm.dev-access_log combined
	RewriteEngine on
	RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
</VirtualHost>
