How to create multiple websites for Apache server using Vhosts
# This one is pretty simple - we’re just using common Unix commands.
# I find this one helpful when I don’t want to generate a rails site skeleton on the server.
# create web application skeletal structures
cd ~/public_html
# domain 1
mkdir -p mydomain1.com/{backup,cgi-bin,log,private,public}
mkdir -p mydomain1.com/{config,releases,shared,tmp}
mkdir -p mydomain1.com/tmp/pids
# create symlinks for a capistrano site here
ln -s /home/super/public_html/mydomain1.com /home/super/public_html/mydomain1.com/current
ln -s /home/super/public_html/mydomain1.com/log /home/super/public_html/mydomain1.com/shared/log# domain 2 (optional)
mkdir -p mydomain2.net/{backup,cgi-bin,log,private,public}
mkdir -p mydomain2.net/{config,releases,shared,tmp}
mkdir -p mydomain2.net/tmp/pids
# create symlink for capistrano site here
ln -s /home/super/public_html/mydomain2.net /home/super/public_html/mydomain2.net/current
ln -s /home/super/public_html/mydomain2.net/log /home/super/public_html/mydomain2.net/shared/log# domain 3 (optional)
mkdir -p mydomain3.ws/{backup,cgi-bin,log,private,public}
mkdir -p mydomain3.ws/{config,releases,shared,tmp}
mkdir -p mydomain3.ws/tmp/pids
# create symlink for capistrano site here
ln -s /home/super/public_html/mydomain3.ws /home/super/public_html/mydomain3.ws/current
ln -s /home/super/public_html/mydomain3.ws/log /home/super/public_html/mydomain3.ws/shared/log
# to see what was created in the above code, use “ls -la” command (optional)
ls -la ~/public_html/
ls -la ~/public_html/mydomain1.com
ls -la ~/public_html/mydomain2.net
ls -la ~/public_html/mydomain3.ws
# enable (turn on) website applications in apache
sudo a2ensite mydomain1.com
sudo a2ensite mydomain2.net
sudo a2ensite mydomain3.ws# disable (turn off) website applications in apache
#sudo a2dissite mydomain1.com
#sudo a2dissite mydomain2.net
#sudo a2dissite mydomain3.ws
# (re)start apache server
sudo /etc/init.d/apache2 start
# or
sudo /etc/init.d/apache2 reload
# visit your sites in a web browser
http://mydomain1.com
http://mydomain2.net
http://mydomain3.ws
# secure versions (self-signed)
https://mydomain1.com
https://mydomain2.net
https://mydomain3.ws
Done!
























Kathy said,
Wrote on August 3, 2008 @ 7:31pm
Hello people! Nice site!
Timmy said,
Wrote on August 4, 2008 @ 10:53am
Lucky to find you, keep on the good workk guys! Best of luck.u
Ron said,
Wrote on August 12, 2008 @ 5:40am
Great site. I will bookmark for my sons to view as well!!!/
jeroen said,
Wrote on August 14, 2008 @ 10:31pm
This website is very nice and colorful too. Its nice to have something to show others where you attend church and to show all the smiling people filled of the goodness of the Lord. You have a wonderful website here. May God rich bless you always.