Step 1: Create a your own folder lets call it 'myproject'. Create a simple html file inside this folder
Step 2: Go inside 'myproject' and create a file 'index.html' and put following code in this file
‹ html ›
‹ body ›
It works !!
‹/body ›
‹/htm ›
commands:
> mkdir myproject
> cp -r myproject /usr/share/doc/
> cp -r myproject /usr/share/doc/
>sudo ln -s /usr/share/doc/myproject /var/ww/myproject
Now at this point of time you have created a test to check if your virtual host setting is working fine or not
Step 3: creating virtual host
>sudo vi /etc/apache2/sites-enabled/000-default
Now add following lines in this file
--------------------------------------------------
‹VirtualHost *:80›
ServerAdmin xyz@gmail.com
DocumentRoot "/var/www/myproject/"
ServerName myproject
‹/VirtualHost ›
--------------------------------------------------
Step 3: >sudo /etc/init.d/apache2 restart
Step 4: >sudo vi /etc/hosts
and add following lines in this file
-------------------------------------------
127.0.0.1 myproject
yourIP myproject
--------------------------------------------
Step 5: Set no proxy for 'myproject'
Step 6: Open http://myproject
If any php script present is myproject folder is not working add following line in virtual host setting file
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
So your final Virtual host setting will look like as follows
--------------------------------------------------
‹VirtualHost *:80›
ServerAdmin xyz@gmail.com
DocumentRoot "/var/www/myproject/"
ServerName myproject
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
‹ /VirtualHost ›
--------------------------------------------------
For any doubt feel free to ask !!
No comments:
Post a Comment