Skip to main content

Posts

Showing posts from February, 2012

Name Based Virtual Hosting in apache2

In name based virtual hosting we run several web sites in one IP address.To do that request from browser should come in HTTP/1.1 protocol. To demonstrate this process I used this scenario. Imagine we have three web sites called as www.bict,lk , www.ucsc.lk and www.scs.lk. And our apache server runs in 192.168.1.1IP address and 8080 port. Following document roots are used. www.bict.lk    /var/opt/www.bict.lk/htdocs www.ucsc.lk   /var/opt/www.ucsc.lk/htdocs www.scs.lk   /var/opt/www.scs.lk/htdocs In an each htdocs directory you should create separate index.html files. note : You can change those document root in /etc/apache/sites-available/default file. And it has default document root as /var/www . To edit that use $ vi /etc/apache/sites-available/default    command. There should be a index files (index.html) relevant to each web site. To make easy understand I explain this step by step . step 1.      Edit the ports.conf file     $vi /etc/apache2/ports.conf     In thi

Creating a custom logs in apache2

In this article I try to explain how to create our own log file in apache2. Log files are there to keep records about the details of users ,time , host's IP  etc.. These details are used to analyzed about the users who visits web sites. First of all you had to create a web site and should host in apache server.Following guidelines will help to you.According to your document root create a directories to keep your index file. In my case I keep it /var/www/www.mypage.lk/htdocs. If you are not define custom log file to your site it will go to default place in /var/log/apache2 .And I create a log directory in side the www.mypage.lk to keep records of www.mypage.lk. Normally log files are keep in /var/log/apache2. This is the default directory where apache log files are keep.  In this scenario I create log directory inside the www.mypage.lk directory. So my log file path will be /var/www/www.mypage.lk/logs. go to /etc/apache2 and edit ports.conf file ( you can use an editor like v