440 likes | 619 Views
Web Servers Xingquan (Hill) Zhu xqzhu@cse.fau.edu. Outline. Introduction HTTP Request Type Web Servers Microsoft IIS Apache Web Server Client-Side Scripting vs Server-Side Scripting Requesting Documents PhP. Introduction. Web server Responds to client requests by providing resources
E N D
Web ServersXingquan (Hill) Zhuxqzhu@cse.fau.edu Web Servers
Outline • Introduction • HTTP Request Type • Web Servers • Microsoft IIS • Apache Web Server • Client-Side Scripting vs Server-Side Scripting • Requesting Documents • PhP Web Servers
Introduction • Web server • Responds to client requests by providing resources • URL (Uniform Resource Locator) • scheme: object-address • Web server and client communicate with platform-independent Hypertext Transfer Protocol (HTTP) http://www.someschool.edu/someDept/pic.gif path name host name Web Servers
HTTP: hypertext transfer protocol Web’s application layer protocol client/server model client: browser that requests, receives, “displays” Web objects server: Web server sends objects in response to requests Introduction: HTTP HTTP request PC running Explorer HTTP response HTTP request Server running Apache Web server HTTP response Mac running Navigator Web Servers
initiate TCP connection RTT request file time to transmit file RTT file received time time Introduction: HTTP Request Initiate TCP Connection: • a small packet • Hand shaking Request File: • Send HTTP request Persistent vs non-psersistent Keep-alive on/off GET /somedir/page.html HTTP/1.1 Host: www.someschool.edu User-agent: Mozilla/4.0 Connection: close Accept-language:fr (extra carriage return, line feed) Web Servers
Introduction: HTTP Request Type • Request methods • Get • Retrieve and send client form data to Web server • Form data is to be encoded (by a browser) into a URL • http://www.google.com/search?hl=en&q=FAU&btnG=Google+Search • 1024 characters • post • Post data to a server-side form handle • As data attachment • Form data is to appear within a message body • Secure Web Servers
Introduction: Web servers Web Servers
Microsoft IIS • FTP Site • Used for transferring large files across the Internet • HTTP Site • Used most frequently to request documents from Web servers • SMTP Virtual Server • Sends and receives electronic mail • Web Site Content Directory • Directory containing the documents that clients will view Web Servers
General home directory • C:\inetput\wwwroot\ • Can be accessed via • http://localhost/mydocument.html • http://ip.ip.ip.ip/mydocument.html IIS Web Servers
Virtual Directory Web Servers
Virtual Directory Web Servers
Virtual Directory Web Servers
Directory Properties Web Servers
Apache Server • Currently the most popular Web server • Stability • Efficiency • Portability • Open-source Apache Server Installation Web Servers
Select “HTTP Server” Web Servers
Select “Download! From a mirror” Web Servers
Select Apache Server 2.0.59 Win32 Binary and download • Save to your local disk Apache_2.0.59-win32-x86-no_ssl.msi Web Servers
Apache Installation Web Servers
Apache installation Web Servers
Apache installation Web Servers
Apache installation Web Servers
Select apache directory Web Servers
Apache Directory Web Servers
Install Web Servers
Done Web Servers
Apache Configuration • Where is it? Web Servers
Configuration: httpd.conf Web Servers
Configuration: httpd.conf • Web address • http://localhost/directory/.. • 10.20.30.40/directory/ startruncmdipconfig/all • The default directory • Document Root: • H:/Program Files/Apache Group/Apache2/hotdocs • http://localhost or http://127.0.0.1/ • Aliases • Map a local directory to a web directory • Alias /home "h:/xqzhu/apache/homepage/“ • Difference between /home and /home/ • Access control • Order Allow and Deny • Allow from host host … • Deny from host host host … • Order allow, deny vs order deny, allow • order allow,deny • allow from 123.156 • deny from all Web Servers
Configuration: httpd.conf • Apply access control to directories <Directory "H:/xqzhu/apache/homepage/"> Options Indexes Order allow, deny Allow from all </Directory> -------------------------------------------- <Directory "d:/apache/test/"> Options Indexes Order allow, deny Deny from 127.0.0.1 Allow from all </Directory> ---------------------------------------------- Options: none, indexes Question? How to publish a web site content directory? Web Servers
Configuration: httpd.conf • UserDir: • The name of the directory that is appended onto a user's home directory if a ~user request is received • On Windows NT • UserDir "My Documents/My Website" • DirectoryIndex • sets the file that Apache will serve if a directory is requested. • Forbid listing a directory • http://www.cse.fau.edu/~xqzhu • DirectoryIndex index.html goog.html Question again? How to publish a web site content directory? Make sure that you reset the server each time you make the changes Web Servers
Service related parameters: httpd.conf • Listen a specific port • Listen 8080 • The number of seconds before receives and sends time out • Timeout 300 • Whether or not to allow persistent connections • KeepAlive On • KeepAliveTimeout 15 Web Servers
Outline • Introduction • HTTP Request Type • Web Servers • Microsoft IIS • Apache Web Server • Client-Side Scripting vs Server-Side Scripting • Requesting Documents • PhP Web Servers
Client-Side Scripting vs Server-Side Scripting • Client-side scripts (most fancy effects are here, but browser dependent) • Validate user input • Reduce requests needed to be passed to server • Enhance Web pages with DHTML, ActiveX controls, and applets • JavaScript, VBScript, Java Applet • There are many things client-side scripts cannot do… • Server-side scripts (file and database access) • Executed on server • Generate custom response for clients • Wide range of programmatic capabilities • Functionality • PHP (Hypertext Preprocessor), ASP (Active Server Pages), JSP (Java Server Pages) Web Servers
Requesting Documents • Requesting five different documents • XHTML • ASP.NET • Perl • PHP • Python http://localhost/home/php/myphp.php Web Servers
PHP • Server must install PHP • Must lead Apache to find the PHP, in case there is a need to interpret PHP script • Binding PhP with Apache Server • PHP Installation • Configuration Web Servers
PHP Web Servers
Download windows binaries 5.1.6PHP 5.1.6 zip package Web Servers
Unzip the file to a local directory, say h:/php Web Servers
Change php.ini-recommended • Change php.ini-recommended to php.ini • php.ini is the configuration file of PHP Web Servers
Let Apache know where PHP is • Open httpd.conf (Apache configuration) • Find out “#PhP module” • Add following two lines below “# LoadModule” • LoadModule php5_module "h:/php/php5apache2.dll“ • AddType application/x-httpd-php .php • Then you are basically good to go • http://localhost/home/php/form.html Web Servers
Php.ini configuration • Show all errors • error_reporting = E_ALL • The separator used in PHP generated URLs • Default “&” • arg_separator.output = "&" • Separator(s) used by PHP to parse input URLs • Default “&” • arg_separator.input = ";&" • Whether to allow HTTP file upload • file_uploads = On • Temporary directory for HTTP file upload • upload_tmp_dir =“directory” • Numerous features related to PHP, will be addressed at later stage Web Servers
Pluto server • Directly put xxx.php file under any directory you like, Pluto has PhP already. • http://student.cse.fau.edu/~yourid/cop3813/hw6/myphp.php • How to program PhP? Web Servers
Outline • Introduction • HTTP Request Type • Web Servers • Microsoft IIS • Apache Web Server • Client-Side Scripting vs Server-Side Scripting • Requesting Documents • PhP Web Servers