Created
May 29, 2011 09:47
-
-
Save kybernetyk/997614 to your computer and use it in GitHub Desktop.
create directory + append entry to vhosts.conf
This file contains hidden or 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 | |
if [ "$2" = "" ]; then | |
echo "syntax: newhost <domainname> <dirname>"; | |
exit 1; | |
fi | |
echo "domain: $1"; | |
echo "dir: $2"; | |
echo "#domain $1 - dir $2" > http.tmp | |
echo "<VirtualHost *:80>" >> http.tmp; | |
echo " DocumentRoot /var/www/$2" >> http.tmp; | |
echo " ServerName www.$1" >> http.tmp; | |
echo " ServerAlias $1" >> http.tmp; | |
echo " ErrorLog /var/www/$2/logs/error_log" >> http.tmp; | |
echo " CustomLog /var/www/$2/logs/access_log combined" >> http.tmp; | |
echo " CustomLog /var/www/$2/logs/referer_log referer" >> http.tmp; | |
echo " " >> http.tmp; | |
echo " <Directory \"/var/www/$2\">" >> http.tmp; | |
echo " AllowOverride All" >> http.tmp; | |
echo " Options +FollowSymlinks" >> http.tmp; | |
echo " Order allow,deny" >> http.tmp; | |
echo " Allow from all" >> http.tmp; | |
echo " </Directory>" >> http.tmp; | |
echo "</VirtualHost>" >> http.tmp; | |
echo " " >> http.tmp; | |
echo " " >> http.tmp; | |
mkdir $2 | |
mkdir $2/logs | |
cat http.tmp >> vhosts.conf | |
rm http.tmp | |
#/opt/lampp/lampp restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment