virtual host on ubuntu

1- copy file from old one 
sudo cp /etc/apache2/sites-available/oldwebsite.com.conf /etc/apache2/sites-available/newwebsite.com.conf
2- edit it and replace all oldwebsite to new website and change the path 
sudo gedit /etc/apache2/sites-available/newwebsite.com.conf
3- enable it 
sudo a2ensite newsite.com.conf
4- restart apache 
sudo service apache2 restart
sudo gedit /etc/hosts
you know what will you do . Right ?

example of file is 

 ServerAdmin localhost@localhost.com
 DocumentRoot "/mnt/programming/www/hamed/laravel/deals/public
 ServerName deals.com
 ServerAlias www.deals.com
 ErrorLog ${APACHE_LOG_DIR}/error.log
 CustomLog ${APACHE_LOG_DIR}/access.log combined

<VirtualHost *:80>
 ServerAdmin localhost@localhost.com
 DocumentRoot "/var/www/html/site/public"
<Directory /var/www/html/site/public>
 AllowOverride All
 Order allow,deny
 allow from all
 ServerName site.com
 ServerAlias www.site.com
 ErrorLog ${APACHE_LOG_DIR}/error.log
 CustomLog ${APACHE_LOG_DIR}/access.log combined


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s