Here some instruction how to configure virtual host on your Linux system.

  1. First you have to create a folder where your site will be. I found very useful this directory: /var/www/mynewsite.here
  2. Then you have to go cd /etc/apache2/sites-available .
  3. Create new file in this directory:  sudo gedit your_site.conf , where gedit is default edit tool, so you can write yours.
  4. Write below in your .conf file and save it. jquery.me is my website’s name you have to choose yours.

  5. <VirtualHost *:80>

        ServerName jquery
        ServerAlias jquery.me http://www.jquery.me
        DocumentRoot /var/www/jquery.me

    </VirtualHost>

  6. After just type:  sudo a2ensite your_site.conf
  7. And add your site to hosts: sudo gedit /etc/hosts
  8. 127.0.0.1 your_site.com http://www.your_site.com

  9. After restart apache server: sudo service apache2 restart
  10. That’s it! Just type in your browser address of your newly created website.
Advertisements