Web Server Configuration Alokes Chattopadhyay Computer & Informatics Centre IIT Kharagpur Web Services • How Web servers bring pages into your home, school or office • The Basic Process • The browser formed a connection to a Web server, requested a page and received it • A bit more detail e.g. http://www.iitkgp.ac.in • The protocol used ("http") • The server name (“www.iitkgp.ac.in") • The file name (“index.htm (by default)") • The browser communicated with a name server to translate the server name "www.iitkgp.ac.in" into an IP Address, which it uses to connect to the server machine. The browser then formed a connection to the server at that IP address on port 80 (default). Web Application Server Web Application Server • Web application servers are designed specifically to extend web servers to support dynamic content • The application server software “hooks in” to the web server software and automatically intercepts any user requests for dynamic content • The web server still sends out static web pages and graphic files • the application server can create dynamic content by mixing data with templates, running programs, or by accessing databases • There are a variety of Web Application Server product available • • • • Macromedia Cold Fusion Microsoft ASP .Net J2EE Web Servers – A Client Server architecture • In general, all of the machines on the Internet can be categorized as two types: servers and clients • Those machines that provide services (like Web servers or FTP servers) to other machines are servers. And the machines that are used to connect to those services are clients. • A server machine may provide one or more services on the Internet. For example, a server machine might have software running on it that allows it to act as a Web server, an e-mail server and an FTP server • A Web browser on local machine, it will most likely want to talk to the Web server on the server machine. The Telnet application will want to talk to the Telnet server, the e-mail application will talk to the e-mail server, and so on... IP-address • Each machine on the Internet is assigned a unique address called an IP address • IP stands for Internet protocol, and these addresses are 32-bit numbers, normally expressed as four "octets" in a "dotted decimal number." • A typical IP address looks like this: 10.3.100.103 • Every machine on the Internet has a unique IP address. A server has a static IP address that does not change very often • If you are working on a Windows machine, you can view a lot of the Internet information for your machine, including your current IP address and hostname, with the command IPCONFIG.EXE • On a UNIX machine, type nslookup at the command prompt, along with a machine name, like www.iitkgp.ac.in • an IP address is all you need to talk to a server. For example, in your browser, you can type the URL http://10.3.100.103 and arrive at the machine that contains the Web server for www.iitkgp.ac.in Domain Names • Because most people have trouble remembering the strings of numbers that make up IP addresses, and because IP addresses sometimes need to change, all servers on the Internet also have human-readable names, called domain names • For example, www.iitkgp.ac.in is a permanent, human-readable name. It is easier for most of us to remember the name than it is to remember 10.3.100.103 • • • • The name www.iitkgp.ac.in actually has four parts: The host name ("www") The domain name (“iitkgp.ac") The top-level domain name (“in“) • A set of servers called domain name servers (DNS) maps the human-readable names to the IP addresses. • These servers are simple databases that map names to IP addresses, and they are distributed all over the Internet Ports • Web server would typically be available on port 80 • If we were to set up our own machine and load Web server software on it, we could put the Web server on port 918 e.g. or any other unused port. • Then, the machine are known as xxx.yyy.com, someone on the Internet could connect to our server with the URL http://xxx.yyy.com:918. The ":918" explicitly specifies the port number, and would have to be included for someone to reach your server. • When no port is specified, the browser simply assumes that the server is using the well-known port 80. Web Server Packages • Basic Apache server configuration [RHEL] basic steps When we are working with Apache, we need two packages. The first is httpd, which actually installs the Apache web server. The second is the mod_ssl package, which provides the ability to create secure websites • Step 1. Install the two required packages: # yum install –y httpd mod_ssl • Step 2. Verify that the packages were installed correctly: # rpm -qa | grep http • httpd-2.2.15-5.el6.x86_64 • httpd-tools-2.2.15-5.el6.x86_64 # rpm -qa | grep ssl • mod_ssl-2.2.15-5.el6.x86_64 • openssl-1.0.0-4.el6.x86_64 • Step 3. With the packages installed, make sure that the service is set to start when the system boots: # chkconfig httpd on • Open http main config file • # vi /etc/httpd/conf/httpd.conf • DocumentRoot “/var/www/html” • Test the config file: • • • • # service httpd configtest # service httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ] • Now finally open browser and check the web site • http://yourlocalIP or http://127.0.0.1 • ServerRoot – this specifies location in the Linux file system where the httpd.conf file will be found • DocumentRoot – this specifies the location in the Linux file system where the html files and other web documents will be stored • never make ServerRoot and DocumentRoot be the same directory as this leads to security holes. People could potentially access and alter configuration files. • If DocumentRoot is /var/www/html and the URL is http://www.someserver.com/dir1/dir2/file1.html then the file accessed is /var/www/html/dir1/dir2/file1.html NOTE: Document Root’s path should not end with a / to make sure this works correctly! • ServerName – this is the IP alias of the server • in order to establish this, we must also have the ServerName to IP address mapping stored in DNS tables • DirectoryIndex – a list of files that the server will attempt to find in a given directory if no file name is given in the URL e.g., DirectoryIndex index.html index.shtml index.php • User, Group – define the user and group that will own the apache processes typically both default to apache or www Step by Step guide to install IIS 6.0 in win server 2003 XAMPP (pronounced as ZAMP) – • A free and open source cross-platform web server solution stack package, consisting mainly of the Apache HTTP Server, MySQL database, and interpreters for scripts written in the PHP and Perl programming languages. Acronym for: X- Read as "cross", meaning cross-platform A-Apache HTTP Server M-MySQL P-PHP P-Perl • How to install ? • Go to http://www.apachefriends.org/en/xampp.html • Versions available for Linux, Windows, Solaris, Mac OS X • Steps for Installation • http://wiki.fiforms.org/index.php/Installing_XAMPP Web Application Framework • A web application framework (WAF) is a software framework that is designed to support the development of dynamic websites, web applications, web services and web resource • Framework Applications • General purpose website framework (e.g. Zend http://framework.zend.com/) • Organizational Portals • JBOSS Portal (e.g. JBOSS http://www.jboss.org/) • Content management systems (CMS) • Drupal (www.drupal.org) • Joomla (www.joomla.org) • Wordpress (www.wordpress.org) Thank you