1. To login to the aws server, go to location
#cd ~user/public_html/support
execute the command :
ssh -i domain.com.pem user@IP (PEM file is used to ssh to aws server. It is uploaded to location ~user/public_html/support)
Once logged in, execute:
sudo su -
2. Create a virtual host in aws server.
#mkdir -p /var/www/domain.com/public_html
#chown -R www-data:www-data /var/www/domain.com/public_html
#cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/domain.com.conf
Create a link as below :
#cd /etc/apache2/sites-enabled
#ln -s /etc/apache2/sites-available/domain.com.conf domain.com.conf
#ls -l domain.com.conf
#lrwxrwxrwx 1 root root 34 Apr 2 15:48 domain.com.conf -> ../sites-available/yedia.info.conf
Make following entries in configuration file:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
To enable, execute command:
a2ensite domain.com.conf
cd ~user/public_html/support
rsync -e "ssh -i domain.com.pem" -avz /home/user/public_html/* user@IP:/var/www/domain.com/public_html/
rsync the database, assign privileges.
If you get permission error in rsync,
set ,
#chmod 777 /var/www/yedia.info/public_html/ and change the permission afterwards.
Reference URL:
https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-12-04-lts
http://www.beginninglinux.com/home/backup/rsync-server-to-local-using-ssh-and-pem-key
http://www.reddit.com/r/sysadmin/comments/1kjguj/
#cd ~user/public_html/support
execute the command :
ssh -i domain.com.pem user@IP (PEM file is used to ssh to aws server. It is uploaded to location ~user/public_html/support)
Once logged in, execute:
sudo su -
2. Create a virtual host in aws server.
#mkdir -p /var/www/domain.com/public_html
#chown -R www-data:www-data /var/www/domain.com/public_html
#cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/domain.com.conf
Create a link as below :
#cd /etc/apache2/sites-enabled
#ln -s /etc/apache2/sites-available/domain.com.conf domain.com.conf
#ls -l domain.com.conf
#lrwxrwxrwx 1 root root 34 Apr 2 15:48 domain.com.conf -> ../sites-available/yedia.info.conf
Make following entries in configuration file:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
To enable, execute command:
a2ensite domain.com.conf
cd ~user/public_html/support
rsync -e "ssh -i domain.com.pem" -avz /home/user/public_html/* user@IP:/var/www/domain.com/public_html/
rsync the database, assign privileges.
If you get permission error in rsync,
set ,
#chmod 777 /var/www/yedia.info/public_html/ and change the permission afterwards.
Reference URL:
https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-12-04-lts
http://www.beginninglinux.com/home/backup/rsync-server-to-local-using-ssh-and-pem-key
http://www.reddit.com/r/sysadmin/comments/1kjguj/