Assume mywebsite.com is one of the domains your hosting on your server.
----------------------
- On Local Machine
----------------------
#sudo vi /etc/hosts
Add this to the bottom
184.1.1.1 mywebsite.testing
----------------------
- On Server
----------------------
#vi /etc/hosts
Add this to the bottom
184.1.1.1 mywebsite.com mywebsite.testing
#vi /etc/httpd/conf.d/vhosts.conf
Add this virtual host entry
NameVirtualHost *:80
<VirtualHost *:80>
        DocumentRoot /var/www/vhosts/mywebsite.com/httpdocs
        ServerName mywebsite.com
        ServerAlias www.mywebsite.com mywebsite.testing
        
       <Directory "/var/www/vhosts/mywebsite.com/httpdocs">
            Options Indexes FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>
</VirtualHost>
#service httpd restart
You should now be able to put mywebsite.testing in your browser and be
directed to the appropriate vhost.
 
No comments:
Post a Comment