Ch 22: Web Hosting and Internet Servers

30
Ch 22: Web Hosting and Internet Servers LaShall Bates

description

Ch 22: Web Hosting and Internet Servers. LaShall Bates. Web Hosting. Providing Raw web pages (HTML) FTP SSL Streaming audio or video. Linux vs. Windows hosting???. Linux provides Maintainability and performance Multi user, interactive OS Multi task Administration - PowerPoint PPT Presentation

Transcript of Ch 22: Web Hosting and Internet Servers

Page 1: Ch 22: Web Hosting  and Internet Servers

Ch 22: Web Hosting and Internet Servers

LaShall Bates

Page 2: Ch 22: Web Hosting  and Internet Servers

Web Hosting

• Providing– Raw web pages (HTML)– FTP– SSL– Streaming audio or video

Page 3: Ch 22: Web Hosting  and Internet Servers

Linux vs. Windows hosting???

• Linux provides– Maintainability and performance– Multi user, interactive OS– Multi task Administration– Can be tuned to be faster

Page 4: Ch 22: Web Hosting  and Internet Servers

The Basics

• A web server is a system configured to answer HTTP requests. Browsers contact these remote web servers and make requests on behalf of users.

• To convert a generic Linux system, install a daemon that listens for connections on TCP port 80, accepts requests for docs and transmits them to the requesting user.

Page 5: Ch 22: Web Hosting  and Internet Servers

URL

• Uniform Resource Locator, the global address of docs and other resources on the WWW.

• 5 parts of the address1. What protocol to use

2. IP address or the domain name where the resource is located.

3. TCP/IP port (opt)

4. Directory (opt)

5. Filename (case sensitive)

Page 6: Ch 22: Web Hosting  and Internet Servers

URL ex.

• An executable file that should be fetched using the FTP protocol– ftp://uark.edu/stuff.exe

• A Web page that should be fetched using the HTTP protocol – http://uark.edu/classes/index.html

Page 7: Ch 22: Web Hosting  and Internet Servers

URL Protocols

• http - hypertext transfer protocol (WWW) • https - secure http (use HTTP/SSL• ftp - file transfer protocol (FTP) • news - Usenet news protocol • javascript - local javascript execution • file - local files on local computer • mailto - sends mail to specified e-mail address• telnet - used to open telnet sessions • ldap – access LDAP directory services

Page 8: Ch 22: Web Hosting  and Internet Servers

How HTTP works

• HyperText Transfer Protocol, the underlying protocol used by the WWW.

• HTTP defines how messages are formatted and transmitted, and what actions Web servers and browsers should take in response to various commands.

• For example, when you enter a URL in your browser, this actually sends an HTTP command to the Web server directing it to fetch and transmit the requested Web page.

Page 9: Ch 22: Web Hosting  and Internet Servers

HTTP: Stateless Protocol

• HTTP is called a stateless protocol because each command is executed independently, without any knowledge of the commands that came before it. This is the main reason that it is difficult to implement Web sites that react intelligently to user input.

Page 10: Ch 22: Web Hosting  and Internet Servers

CGI

• The shortcoming of HTTP is being addressed in a number of technologies, including CGI, ActiveX, Java, JS and cookies.

• CGI is a specification that allows the designer to provide active changing web content. It allows the HTTP server to exchange info with other programs.

Page 11: Ch 22: Web Hosting  and Internet Servers

CGI: generating on the fly

• CGI scripts can be C(++), Perl, Python or any other program that can perform real-time I/O

Page 12: Ch 22: Web Hosting  and Internet Servers

CGI: security

• CGI poses a security problem for Admins. It can potentially allow anyone to run a program on your server and/or gain access to files.

Page 13: Ch 22: Web Hosting  and Internet Servers

Load balancing

• Hits/page views a server can handle. • Dependent on

– Operating system

– System tuning

– Hardware architecture

– Construction of site

• More important: Scalability– Products spread the work specified by a variety of

admin-config params such as individual server response time and availability

Page 14: Ch 22: Web Hosting  and Internet Servers

Choosing a Server

• Robustness• Performance• Timeliness of updates and bug fixes• Availability of source code• Cost• Access control and security• Ability to act as a proxy• Ability to handle encryption

Page 15: Ch 22: Web Hosting  and Internet Servers

Apache

• The August 2002 Netcraft Web Server Survey found that 63% of the web sites on the Internet are using Apache, thus making it more widely used than all other web servers combined.

Page 16: Ch 22: Web Hosting  and Internet Servers

Apache

1. The name 'Apache' was chosen from respect for the Native American Indian tribe of Apache, well-known for their superior skills in warfare strategy and their inexhaustible endurance.

2. Secondarily, and more popularly (though incorrectly) accepted, it's a considered cute name which stuck. Apache is "A PAtCHy server". It was based on some existing code and a series of "patch files".

Page 17: Ch 22: Web Hosting  and Internet Servers

Installing Apache

• If you want to compile source code yourself– ./configure –prefix=/etc/httpd/

• Include or remove features– enable-module=, disable-module=

• For a complete list of modules http://httpd.apache.org/docs/mod/

• Run make, then make install to compile and install appropriate files

Page 18: Ch 22: Web Hosting  and Internet Servers

Configuring Apache

• After installation, configure setup– conf directory (/etc/httpd/conf)

• 3 files to configure– httpd.conf– srm.conf– access.conf

Page 19: Ch 22: Web Hosting  and Internet Servers

Apache Conf files: httpd

• httpd.conf– How Apache daemon interacts with system.

• Set TCP port• location of log files• various network and performance params• Configure virtual connections

Page 20: Ch 22: Web Hosting  and Internet Servers

Apache Conf files: srm

• srm.conf– Controls resources server needs– DocumentRoot def: defines root of directory

tree in which servable docs are located. – Also handling of “special” URLs (ex.

http://comp.uark.edu/~crane)

Page 21: Ch 22: Web Hosting  and Internet Servers

Apache Conf files: access

• access.conf– Security concerns– Directives that control access on a per-file pr

per-dir basis, prevents access to sensitive files vs. httpd

– Use option ExecCGI in srm.conf to enable CGI restrictions

• Allows two access controls one for entire doc dir and one for cgi-bin.

Page 22: Ch 22: Web Hosting  and Internet Servers

Running Apache

• Start by hand– /usr/sbin/httpd –f /etc/httpd/conf/httpd.conf

• or from rc scripts– Run at boot time make link in rc directory that

points to /etc/init.d/httpd file– Start late in booting sequence after daemons

that manage functions such as routing and time synchronization have started

Page 23: Ch 22: Web Hosting  and Internet Servers

High performance Hosting

• TUX is an architecture for kernel-accelerated network services.

• Runs in conjunction with Apache

• Serves up static pages without leaving kernel space. Minimizes context switches with a zero-copy architecture.Not recommended for beginners

Page 24: Ch 22: Web Hosting  and Internet Servers

Virtual Interfaces

• Allowing the hosting of more than one web site by associating more than one IP address with a system.

• Allows daemon to identify request’s destination IP address.

• Single Linux machine responds on the network to more IP addresses than it has physical network interfaces. Each of the result “virtual” network interfaces can be associated with a corresponding domain name that users on the Internet might want to connect to.

Page 25: Ch 22: Web Hosting  and Internet Servers

Needs of Virtual Interfaces

• Create the virtual interface at TCP/IP level– ifconfig eth0:0 128.138.243.150 netmask 255.255.255.255.192 up

– To make permanent modify startup

• Tell Apache server about virtual interfaces created.– Add VirtualHost clause to httpd.conf file– One for each virtual interface

Page 26: Ch 22: Web Hosting  and Internet Servers

Caching and Proxy Servers

• Squid Internet Object Cache– Caching and proxy server that runs under Linux

and supports several protocols

• How it works– Client browser contacts squid to request object– Squid makes request on client’s behalf (or finds

cached copy) and returns result to client– Proxy servers can enhance security or filter

content

Page 27: Ch 22: Web Hosting  and Internet Servers

Anonymous FTP server

• Lets users have accounts to download files you have made available.

• Create user--------------------------------

• Create the user ftp in /etc/passwd. – Misc group, let ~ftp be root you wish anon.

users to see. – Use invalid psw and use shell for better security

ftp:*:400:400:Anonymous FTP:/home/ftp:/bin/true

Page 28: Ch 22: Web Hosting  and Internet Servers

Anonymous FTP: create user dir

• Home directory:– Owned by root, same group as ftp, so Group

permissions will be for anonymous users– Set the permissions for ~ftp to 555 (read, nowrite,

execute).– Create subdirs: bin, etc, lib, and pub– Copy ls program to ~ftp/bin and its shared libraries to

~ftp/lib– Copy /etc/passwd and group files to ~ftp/etc

• Should only contain users root, daemon, and ftp• Replace psw with *’s

Page 29: Ch 22: Web Hosting  and Internet Servers

Anonymous FTP: Use

• Put files you want to make available in ~ftp/pub

Page 30: Ch 22: Web Hosting  and Internet Servers

Questions

References:http://Apache.orghttp://webopedia.comhttp://squid.nlanr.net/