Steps for Creating Vhosts in Ubuntu :
1)
Create the folders that will host your new sites. By default, Apache in Ubuntu serves from /var/www
2)
mkdir /var/www/site
3)
cp /etc/apache2/sites-available/default /etc/apache2/sites-available/site
4)
Edit the new config files for each site using your preferred text editor. Add the line ServerName server1 right below the ServerAdmin line and change both DocumentRoot and Directory to point to your new sites. repeat this step for as many new sites as you’ll be creating
/etc/apache2/sites-available/site
<VirtualHost *:80> ServerAdmin webmaster@localhost ServerName site1 DocumentRoot /var/www/site <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /var/www/site1/> Options -Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
5)
After you have edited the config files just tell Apache to start serving the
new domains and stop serving the default:
sudo a2ensite site
6)
Now reload apache and you should be able to get to each of your new domains
sudo /etc/init.d/apache2 reload
7)
for disabling the site use command
sudo a2dissite site
No comments:
Post a Comment