Friday, 15 March 2013

How to setup virtual hosts with xampp.

Steps to setup the virtual hosts with XAMPP are as follows:

1.Launch Notepad and open the hosts file located at C:\windows\system32\drivers\etc\hosts
                            (You may not be able to see the windows folder–some files are hidden by default under Windows. Here are instructions to make those files visible.)
On Vista, you’ll also need to have access to change the hosts file. To do that, launch Notepad by right clicking on Notepad from the Start menu and choosing "Run As Administrator." This will give you permission to edit and save the file.
2.At the end of that file type:  127.0.0.1      clientA.local
                 127.0.0.1 is how a computer refers to itself—it’s an IP address that points back to the computer, kind of like a computer’s way of saying "ME." The second part (clientA.local) is the "domain" of the virtual host. To visit this domain in a Web browser you’d type http://clientA.local. You don’t have to add the .local part to the hosts files—you could just as easily add 127.0.0.1 clientA and access the site in your Web browser with http://clientA—but I find it helpful for differentiating between a real Web site out on the Internet likeclientA.com, and the test sites I have running on my own computer.
3.Save and close the hosts file.

                  That finishes the first part of this task. You’ve prepared your computer to handle requests to http://clientA.local. Now you need to tell the Web server, Apache, how to handle those requests.
4.In Notepad open the Apache configuration file located at C:\xampp\apache\conf\extra\httpd-vhosts.conf
5.At the bottom of that file add:

NameVirtualHost *
  <VirtualHost *>
        DocumentRoot "C:\xampp\htdocs"
        ServerName localhost
  </VirtualHost>
  <VirtualHost *>
        DocumentRoot "C:\Documents and Settings\Me\My Documents\clientA\website"
        ServerName clientA.local
  <Directory "C:\Documents and Settings\Me\My Documents\clientA\website">
         Order allow,deny
         Allow from all
  </Directory>
</VirtualHost>
  
The first five lines of code turn on the Virtual Host feature on Apache, and set up the C:\xampp\htdocs folder as the default location for http://localhost. That’s important since you need to be able to access the XAMPP web pages at http://localhost/ so that you can use PHPMyAdmin.
The stuff in yellow represents a single Virtual Host. You’ll add one chunk of code just like this for each Virtual Host (or Web site) on your computer
You’ll need to modify the stuff highlighted in blue. The first item — DocumentRoot — indicates where the files for this site are located on your computer. The second part–ServerName — is the name you provided in step 2 above: the virtual host name. For example, clientA.local. The third item — the <Directory> part — is the same path you provided for the DocumentRoot. This is required to let your Web browser have clearance to access these files.
6. Save and close the Apache configuration file, and restart Apache from the XAMPP control panel.
7. Start a Web browser and type a URL for the virtual host. For example: http://clientA.local/.
You should now see the home page for your site.

Thursday, 7 March 2013

Difference between tomcat , catalina and apache

Difference between tomcat , Catalina and Apache is as follows:

The Apache Web Server, often just called “Apache” or “httpd”, was developed in 1995 by Robert McCool and continuous development as well as maintenance is provided by the Apache Software Foundation. Known as the most popular web server.This is a huge accomplishment for a server that is an entirely an open-source project.
                The Apache Web Server is a C language implementation of an HTTP web server and can run a variety of features and modules to extend the core functionality.
  • It is faster than Tomcat when serving static pages.
  • Apache has more configuration options than Tomcat.
  • Supports CGI scripts, Server API modules, Perl, PHP, etc
  • It is more robust than Tomcat.
                   The big downside for Apache is the lack of functionality for Java Servlets or JavaServer Pages, which cannot be run with Apache’s web server. Tomcat was created to address this problem.

Apache Tomcat, otherwise known as “Tomcat” is an open-source web server that started as a servlet reference in 1999 and is developed and maintained by the Apache Software Foundation. It is a Java implementation that runs Java Servlets and JavaServer Pages, known as JSPs, as specified from Oracle. Often used together, Tomcat can be a valuable addition to your Apache Web Server installation; however, Tomcat can also stand on its own as a web server without Apache.
  • Tomcat provides the Java Servlet and JSP support for dynamically served pages.
  • Works as a light-weight testing server.
  • Tomcat can be run in different modes to promote better performance
Tomcat is a Web Server that handles server side Java (in the form of Servlets and JSPs), and it's a part of the Apache Jakarta project group. Tomcat is the "reference" implementation of the Servlet and JSP standards - in other words, if it runs under Tomcat, it should run under any compliant Servlet / JSP container.

Catalina is Tomcat's servlet container. Catalina implements Sun Microsystems' specifications for servlet and JavaServer Pages (JSP). In Tomcat, a Realm element represents a "database" of usernames, passwords, and roles assigned to those users. Different implementations of Realm allow Catalina to be integrated into environments where such authentication information is already being created and maintained, and then use that information to implement Container Managed Security as described in the Servlet Specification..
                Catalina is the Java Engine (JRE / JVM) that's built into Tomcat and provides an environment in which Servlets can be run.