Hosting multiple sites with Apache and Cent OS
Assuming you have the setup Apache Web Server& CentOS installed by default
DNS Settings
Make sure your domain name pointing to the VPS/Dedicated Hosting server IP.To check login to your domain control panel check the name server and A record (probably under DNS Settings/Manage DNS menu) entries are correct.
Server Settings
Open up your vps/dedicated server console using putty login to your server as root, find your httpd.conf file under /etc/httpd/conf folder, make a backup of httpd.conf before going to make any changes using cp command
Two host multiple sites with apache we can use Name based virtual hosts, or IP based virtual hosts. Here i am going to use Name based virtual hosts
Assuming you have the setup Apache Web Server& CentOS installed by default
DNS Settings
Make sure your domain name pointing to the VPS/Dedicated Hosting server IP.To check login to your domain control panel check the name server and A record (probably under DNS Settings/Manage DNS menu) entries are correct.
Server Settings
Open up your vps/dedicated server console using putty login to your server as root, find your httpd.conf file under /etc/httpd/conf folder, make a backup of httpd.conf before going to make any changes using cp command
- Change your directory as shown in figure cd /etc/httpd/conf
- Make backup of your httpd.conf by issuing command cp httpd.conf httpd.conf.bkup
- Make sure backup done using list file commsnd ls
Two host multiple sites with apache we can use Name based virtual hosts, or IP based virtual hosts. Here i am going to use Name based virtual hosts
To enable multiple host support you must add, or uncomment, the following line in /etc/httpd/conf/httpd.conf:
NameVirtualHost *
This sets up Apache to accept the hosts.
If i am going to host two sites named sitea.com & siteb.com then i have to create two directories under /var/www
/var/www/sitea.com
/var/www/siteb.com
then i have to change/add my httpd.conf should have the following lines
<VirtualHost *:80>
ServerAdmin root@localhost
DocumentRoot "/var/www/sitea.com"
ServerName sitea.com ServerAlias www.sitea.com vps.sitea.com
ErrorLog logs/error_log
CustomLog logs/sitea_access_log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin root@localhost
ServerName siteb.com
ServerAlias www.siteb.com
DocumentRoot "/var/www/siteb.com"
ErrorLog logs/in_error_log
CustomLog logs/siteb_access_log combined
</VirtualHost>
Restart the Apache HTTP Server daemon
service httpd restart
And you are done!.
6 comments:
Thanks for sharing this information
We are one of the Best service provider in Dubai like:-
Mobile app Development Company in Dubai
at http://www.appslure.online
Mobile app development company in Kuwait at
http://www.appslure.online/mobile-app-development-company-kuwait.html
Mobile App Development Company in Abu Dhabi
at http://www.appslure.online/mobile-app-development-company-abu-dhabi-uae.html
I really like it whenever people get together and share opinions. Great blog, keep it up!
TellCulvers
TellDunkin
Thank you for sharing the wonderful article. It provides great information and looking beautiful blog.
Machine Learning Datasets | AI support
Php Development Company
Python Development Company
E-Commerce website Development company
Custom Web Development Company
Web development company in India
Thanks for sharing this blog its very helpful to implement in our work
Learn Japanese Language | Learn Japanese Online
Found some really interesting content on this blog, really informative source of content Assignment Help Writers
Really incredible blog, You've choose such a right topic to describe on this platform. Found some really exceptional ideas in this Blog. Asan Bazaar
Post a Comment