find ./ -type f -name '*source-string*'

apache vhost generator

#!/bin/bash
SERVER_ADMIN="[email protected]"
DOCUMENT_ROOT="/var/www/"
LOG_DIR="/var/log/"
VIRT_DOMAIN_DIR="/etc/apache2/sites-available/"
DOMAINS="
domain1.com
domain2.com
domain3.com
"
for DOMAIN in $DOMAINS; do 
cat << EOF > ${VIRT_DOMAIN_DIR}${DOMAIN}
<VirtualHost *:80>
        ServerAdmin $SERVER_ADMIN
        DocumentRoot "${DOCUMENT_ROOT}${DOMAIN}"
        ServerName ${DOMAIN}
        ServerAlias www.${DOMAIN} *.${DOMAIN}
        ErrorLog "${LOG_DIR}error_${DOMAIN}.log"
        CustomLog "${LOG_DIR}access_${DOMAIN}.log" common
        <IfModule mod_rewrite.c>
                RewriteEngine On
                #
                RewriteCond %{HTTP_HOST} ^${DOMAIN}$ [NC]
                RewriteRule ^(.*) http://www.${DOMAIN}\$1 [L,R]
                #
                RewriteCond %{HTTP_HOST} ^mail.${DOMAIN}$ [NC]
                RewriteRule ^(.*) http://mail.google.com/a/${DOMAIN}\$1 [L,R]
                #
                RewriteCond %{HTTP_HOST} ^webmail.${DOMAIN}$ [NC]
                RewriteRule ^(.*) http://mail.google.com/a/${DOMAIN}\$1 [L,R]
                #
                RewriteCond %{HTTP_HOST} ^calendar.${DOMAIN}$ [NC]
                RewriteRule ^(.*) http://google.com/calendar/hosted/${DOMAIN}\$1 [L,R]
                #
                RewriteCond %{HTTP_HOST} ^docs.${DOMAIN}$ [NC]
                RewriteRule ^(.*) http://drive.google.com/a/${DOMAIN}\$1 [L,R]
                #
                RewriteCond %{HTTP_HOST} ^drive.${DOMAIN}$ [NC]
                RewriteRule ^(.*) http://drive.google.com/a/${DOMAIN}\$1 [L,R]
                #
                RewriteCond %{HTTP_HOST} ^groups.${DOMAIN}$ [NC]
                RewriteRule ^(.*) http://groups.google.com/a/${DOMAIN}\$1 [L,R]
                #
                RewriteCond %{HTTP_HOST} ^sites.${DOMAIN}$ [NC]
                RewriteRule ^(.*) http://sites.google.com/a/${DOMAIN}\$1 [L,R]
                #
        </IfModule>
        <Directory ${DOCUMENT_ROOT}${DOMAIN}>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride all
                Order allow,deny
                allow from all
        </Directory>
        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options -Indexes
                #Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
EOF
done



Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.