49 lines
1.0 KiB
Bash
49 lines
1.0 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
alias_block=''
|
||
|
|
||
|
#Create Server Alias Block
|
||
|
if [ ! -z $serveralias ]; then
|
||
|
for alias in $(echo $serveralias | tr ',' ' ')
|
||
|
do
|
||
|
alias_block=$alias_block"ServerAlias $alias
|
||
|
"
|
||
|
done
|
||
|
fi
|
||
|
|
||
|
cat <<EOF > /etc/httpd/conf.d/$domain.conf
|
||
|
|
||
|
<Directory "/home/$user">
|
||
|
AllowOverride None
|
||
|
# Allow open access:
|
||
|
Require all granted
|
||
|
</Directory>
|
||
|
|
||
|
<Directory "/home/$user/public_html">
|
||
|
Options All MultiViews
|
||
|
AllowOverride All
|
||
|
Require all granted
|
||
|
</Directory>
|
||
|
|
||
|
<VirtualHost _default_:*>
|
||
|
ServerName "$domain"
|
||
|
$alias_block
|
||
|
DocumentRoot "/home/$user/public_html"
|
||
|
RewriteEngine on
|
||
|
RewriteCond %{SERVER_NAME} =$domain
|
||
|
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
|
||
|
</VirtualHost>
|
||
|
|
||
|
<IfModule mod_ssl.c>
|
||
|
<VirtualHost _default_:443>
|
||
|
ServerName "$domain"
|
||
|
$alias_block
|
||
|
DocumentRoot "/home/$user/public_html"
|
||
|
|
||
|
|
||
|
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
|
||
|
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
|
||
|
</VirtualHost>
|
||
|
</IfModule>
|
||
|
|
||
|
EOF
|