Created
December 18, 2018 13:50
-
-
Save mafof/4d254a605df6e96682d75c719dc77b02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PATH_APACHE=("/etc/apache2/sites-available" "/etc/apache2/sites-enabled") | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
NORMAL='\033[0m' | |
NAME_SITE="null" | |
DIR_SITE="/mnt/d/Programming_code_.js_PHP" | |
DIR_LOGS="__logs" | |
DOMEN="devs" | |
tput sgr0 | |
function createConfig { | |
echo -en "\n${GREEN}Создаем домен...${NORMAL}" | |
export CONFIGAPACHE=$(cat <<END | |
<VirtualHost *:80> | |
ServerName www.$NAME_SITE.$DOMEN | |
ServerAlias $NAME_SITE.$DOMEN | |
ServerAdmin test@$NAME_SITE.$DOMEN | |
DocumentRoot $DIR_SITE/$NAME_SITE | |
<Directory $DIR_SITE/$NAME_SITE> | |
Options -Indexes +FollowSymLinks +MultiViews | |
AllowOverride ALL | |
Require all granted | |
</Directory> | |
ErrorLog $DIR_SITE/$NAME_SITE/$DIR_LOGS/error.txt | |
CustomLog $DIR_SITE/$NAME_SITE/$DIR_LOGS/error.log combined | |
</VirtualHost> | |
END | |
); | |
echo "$CONFIGAPACHE" >> "${PATH_APACHE[0]}/$NAME_SITE.conf" | |
a2ensite "$NAME_SITE.conf" | |
echo -en "${GREEN}[OK]${NORMAL}" | |
} | |
function main { | |
echo -en "\n${GREEN}Напишите домен(без домена верхнего уровня)${NORMAL}" | |
read selectDomen | |
NAME_SITE=$selectDomen | |
createConfig | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment