Virtual Host

We can create virtual host by adding below code to port.conf file.

First, we need to edit the port.conf file as a root and add below code. After adding the code we need to save and exit. Now we need to restart the apache server.

After following the above procedure we can able to access a sub-domain ux.text.com from url. Here our main URL is "test.com" and we leaned how to create a virtual subdomain "ux.test.com" on our local or linux server.

<VirtualHost *:80>
        ServerName test.com
        ServerAlias www.test.com
       DocumentRoot /var/www/testcode
       <Directory /var/www/testcode>
                Options Indexes FollowSymLinks
                AllowOverride all
                Order allow,deny
                Allow from all
                FileETag MTime Size
                SetOutputFilter DEFLATE
                BrowserMatch ^Mozilla/4 gzip-only-text/html
                BrowserMatch ^Mozilla/4.0[678] no-gzip
                BrowserMatch bMSIE !no-gzip !gzip-only-text/html
        </Directory>
        ErrorLog /var/www/logs/testcode.log
</VirtualHost>    


<VirtualHost *:80>
        ServerName ux.testcode.in
        ServerAlias www.ux.testcode.in
        DocumentRoot /var/www/ux/
        <Directory /var/www/ux/>
                Options Indexes FollowSymLinks
                AllowOverride all
                Order allow,deny
                Allow from all
                FileETag MTime Size
                SetOutputFilter DEFLATE
                BrowserMatch ^Mozilla/4 gzip-only-text/html
                BrowserMatch ^Mozilla/4.0[678] no-gzip
                BrowserMatch bMSIE !no-gzip !gzip-only-text/html
        </Directory>
        ErrorLog /var/www/logs/uxLogerror.log
</VirtualHost>

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>