By following the bellow instruction, we can make the local host as virtual host and can use as like as sub domain locally
1. make available site config from copy the default one. Here is my site will be naimrajb.com and i renamed it with "naimrajb.com"
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/naimrajb.com
2. Open the new created file for set configuration root and others :
sudo gedit /etc/apache2/sites-available/naimrajb.com
here set the following config:
ServerName naimrajb.com //which site name will be
ServerAlias www.naimrajb.com //which site name will be alias
DocumentRoot /var/www/NaimRajb_Project_Folder //where you put the main project directory
<Directory /var/www/CrowdRock1/>Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
3. Enable new created virtual site by following command
sudo a2ensite naimrajb.com
4. Restart apache server
sudo service apache2 restart
5. Open hosts file
sudo gedit /etc/hosts
6. Then add your site in hosts file
127.0.0.1 naimrajb.com
All is done :)
Now browse naimrajb.com
No comments:
Post a Comment