Virtual Hostings2014/08/25 |
Configure Virtual Hostings to use maltiple domain names.
The example below is set on an environment which the domain name is [srv.world],
virtual domain name is [virtual.host (root directory [/home/cent/public_html] ) ]. It's necessarry to set Userdir settings for this example, too. |
|
[1] | Configure Virtual Hostings. |
[root@www ~]#
vi /etc/httpd/conf/httpd.conf # line 990: uncomment NameVirtualHost *:80 # add for original domain to the end <VirtualHost *:80>
DocumentRoot /var/www/html ServerName www.srv.world </VirtualHost> # add for virtual domain to the end <VirtualHost *:80>
DocumentRoot /home/cent/public_html ServerName www.virtual.host ServerAdmin webmaster@virtual.host ErrorLog logs/virtual.host-error_log CustomLog logs/virtual.host-access_log combined </VirtualHost> /etc/rc.d/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ] |
[2] | Create a test page and access to it from a client computer with a web browser. It's OK if following page is shown. |
[cent@www ~]$
vi ~/public_html/virtual.php <html> <body> <div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;"> Virtual Host Test Page </div> </body> </html> |
Sponsored Link |