Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ "$1" == "" ]
- then
- echo "No subdomain given"
- else
- echo "Creating subdomain $1"
- sudo mkdir -p "/home/adnez/subdomains/$1"
- sudo echo "<html><body>$1</body></html>" > "/home/adnez/subdomains/$1/index.html"
- sudo chown "adnez.adnez" "/home/adnez/subdomains/$1" -Rf
- sudo echo "<VirtualHost *:80>
- ServerAdmin webmaster@localhost
- ServerName $1
- ServerAlias www.$1
- DocumentRoot /home/adnez/subdomains/$1
- <Directory />
- Options FollowSymLinks
- AllowOverride All
- </Directory>
- <Directory /home/adnez/subdomains/$1>
- Options Indexes FollowSymLinks MultiViews
- AllowOverride All
- Order allow,deny
- allow from all
- </Directory>
- ErrorLog /var/log/apache2/$1.error.log
- # Possible values include: debug, info, notice, warn, error, crit,
- # alert, emerg.
- LogLevel warn
- CustomLog /var/log/apache2/$1.access.log combined
- </VirtualHost>" > "/etc/apache2/sites-available/$1.conf"
- sudo a2ensite "$1.conf"
- sudo /etc/init.d/apache2 reload
- fi
Advertisement
Add Comment
Please, Sign In to add comment