More than one site? Use multiple configuration files Use multiple configuration files  httpd –d {path}  Assumes “conf/httpd.conf” Logging transactions.

Slides:



Advertisements
Similar presentations
Chapter 6 Server-side Programming: Java Servlets
Advertisements

CS 22: Enhanced Web Site Design - Week 8Slide 1 of 15 Enhanced Web Site Design Stanford University Continuing Studies CS 22 Mark Branom
CGI & HTML forms CGI Common Gateway Interface  A web server is only a pipe between user-agents  and content – it does not generate content.
TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 22 World Wide Web and HTTP.
20-753: Fundamentals of Web Programming 1 Lecture 11: Web Server Case Study Fundamentals of Web Programming Lecture 11: Web Server Case Study.
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
16-Jun-15 HTTP Hypertext Transfer Protocol. 2 HTTP messages HTTP is the language that web clients and web servers use to talk to each other HTTP is largely.
Apache Configuration Setting up a web server. Basic Server Facts Runs on port 80 Server application -> httpd Richly configurable Many defaults will let.
HTTP Hypertext Transfer Protocol. HTTP messages HTTP is the language that web clients and web servers use to talk to each other –HTTP is largely “under.
How the web works: HTTP and CGI explained
CSE 190: Internet Commerce Lecture 4: Web Servers.
Dynamic content 1WUCM1. 2 Basic architecture of the web.
CP476 Internet Computing Browser and Web Server 1 Web Browsers A client software program that allows you to access and view Web pages on the Internet –Examples.
 What is it ? What is it ?  URI,URN,URL URI,URN,URL  HTTP – methods HTTP – methods  HTTP Request Packets HTTP Request Packets  HTTP Request Headers.
1 Web Servers Web Protocols and Practice Chapter 4.
Web Client/Server Communication A290/A590, Fall /09/2014.
Chapter 22 Web Hosting and Internet Servers Xuanxuan Su.
Virtual Hosts The apache server can handle multiple “web sites” at a time – a web service provider company may have multiple different sites to offer (see.
Linux Operations and Administration
Web server and web browser It’s a take and give policy in between client and server through HTTP(Hyper Text Transport Protocol) Server takes a request.
The Linux Operating System Lecture 5: Apache Tonga Institute of Higher Education.
Apache Server The Apache Server Apache is a WWW server that implements the HTTP protocol. Apache runs as a daemon. This means that it is a resident.
Chapter 33 CGI Technology for Dynamic Web Documents There are two alternative forms of retrieving web documents. Instead of retrieving static HTML documents,
An introduction to Apache. Different Types of Web Servers Apache is the default web server for may Unix servers. IIS is Microsoft’s default web server.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
CP476 Internet Computing Lecture 5 : HTTP, WWW and URL 1 Lecture 5. WWW, HTTP and URL Objective: to review the concepts of WWW to understand how HTTP works.
Web application architecture
Implementing ISA Server Publishing. Introduction What Are Web Publishing Rules? ISA Server uses Web publishing rules to make Web sites on protected networks.
5 Chapter Five Web Servers. 5 Chapter Objectives Learn about the Microsoft Personal Web Server Software Learn how to improve Web site performance Learn.
Web Services CSCI N321 – System and Network Administration Copyright © 2007,2008 by Scott Orr and the Trustees of Indiana University.
Python CGI programming
1 Apache. 2 Module - Apache ♦ Overview This module focuses on configuring and customizing Apache web server. Apache is a commonly used Hypertext Transfer.
10/13/2015 ©2006 Scott Miller, University of Victoria 1 Content Serving Static vs. Dynamic Content Web Servers Server Flow Control Rev. 2.0.
Apache Web Server. Aim of this section –Introduce you to workings of the most common webserver –Give you a little experience in role of webmaster Configuring.
CSC 2720 Building Web Applications Server-side Scripting with PHP.
LinuxChix Apache. Serving Webpages The layer 7 protocol (HTTP) is what our browsers talk to get us the websites we can't seem to live without. HTTP is.
The HTTP is a standard that all Web browsers and Web servers must speak in order for the Web portion of the Internet to work.
Form Data Encoding GET – URL encoded POST – URL encoded
AxKit A member of the Apache XML project Ryan Maslyn Kyle Bechtel.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
Multi-Domain Hosting Hosting multiple domains on one server using Apache John Beckett 1/16/2013.
LING 408/508: Programming for Linguists Lecture 17 October 28 th.
IS-907 Java EE World Wide Web - Overview. World Wide Web - History Tim Berners-Lee, CERN, 1990 Enable researchers to share information: Remote Access.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1 Fundamentals.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
Web Server (Apache httpd ) 1. 2 Apache Web Server A PAtCHy server: developed by the Apache group History- First.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
IBM Http Server Basic Administration. CONTENTS Web server IHS How does IHS differ from Apache Basic configurations Advanced Configurations Performance.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
Web Server Administration Chapter 6 Configuring a Web Server.
Lesson 11. CGI CGI is the interface between a Web page or browser and a Web server that is running a certain program/script. The CGI (Common Gateway Interface)
9/21/04 James Gallagher Server Installation and Testing: Hands-on ● Install the CGI server with the HDF and FreeForm handlers ● Link data so the server.
What’s Really Happening
The Common Gateway Interface (CGI) Pat Morin COMP2405.
Web Protocols and Practice
HTTP – An overview.
Redirection Allow requests to be moved about your file system or around the web ScriptAlias Allows you to run CGI scripts Simple to use.
Authentication & .htaccess
MapServer In its most basic form, MapServer is a CGI program that sits inactive on your Web server. When a request is sent to MapServer, it uses.
HTTP Hypertext Transfer Protocol
Unit-5 Chap-1 Configuring Web Server
Common Gateway Interface (CGI current version 1.1)
LING 408/508: Computational Techniques for Linguists
Enabling CGI & PHP With Apache
Requests and Server Response Codes
APACHE WEB SERVER.
HTTP Hypertext Transfer Protocol
CSCI-351 Data communication and Networks
Presentation transcript:

More than one site? Use multiple configuration files Use multiple configuration files  httpd –d {path}  Assumes “conf/httpd.conf” Logging transactions Logging transactions  TransferLog “logs/access_log”  Must tell apache to do logging

ErrorDocument Directive Allows you to provide your own custom error pages Allows you to provide your own custom error pages Syntax: Syntax:  ErrorDocument {error-code} {document}

4 Possible Ways to Handle Errors Apache can be configured to: Apache can be configured to:  Output a simple hardcoded error message  Output a customized message  Redirect to a local URL to handle error  Redirect to an external URL to handle error

ErrorDocument Examples ErrorDocument ErrorDocument ErrorDocument 404 /cgi-bin/bad_link.cgi ErrorDocument 404 /cgi-bin/bad_link.cgi ErrorDocument 401 /error_401.html ErrorDocument 401 /error_401.html ErrorDocument 403 “Sorry – you can’t do that” ErrorDocument 403 “Sorry – you can’t do that”

Block Directives and and

Other Directives ServerName hostname ServerName hostname UseCanonicalName on/off UseCanonicalName on/off ServerAdmin _address ServerAdmin _address ServerRoot directory ServerRoot directory PidFile file PidFile file KeepAlive number KeepAlive number

Other Directives (continued) KeepAliveTimeout seconds KeepAliveTimeout seconds HostNameLookups on/off/double HostNameLookups on/off/double Include filename Include filename

Options Directive Syntax: Syntax:  Options option option …  Default: ALL All All  All options are enabled ExecCGI ExecCGI  Execution of CGI scripts is permitted

Options Directives (continued) Includes Includes  Server-side includes permitted Indexes Indexes  Option allows ways to handle requests if no index.html is located MultiViews MultiViews  Supports AddLanguage and image neg.

Options Examples Arguments are preceded with “+” or “-” Arguments are preceded with “+” or “-” i.e. Options +ExecCGI i.e. Options +ExecCGI If you don’t use + or – than strange things can happen so ALWAYS be explicit If you don’t use + or – than strange things can happen so ALWAYS be explicit Options override previous ones if you’re not explicit with what you want to happen Options override previous ones if you’re not explicit with what you want to happen Web servers ASSUME you know what you’re doing (?) Web servers ASSUME you know what you’re doing (?)

Restarting your server Stop: Kill pid# Stop: Kill pid# Start: httpd –flags Start: httpd –flags or use apachectl or use apachectl Problem with this is loss of service Problem with this is loss of service Alternative to restarting your server Alternative to restarting your server .htaccess file

.htaccess file Text file stored in the htdocs directory Text file stored in the htdocs directory File is read at each access (problems) File is read at each access (problems) Advantages: Advantages:  Very Flexible  Don’t have to stop/start the server AllowOverride directive allows webmaster AllowOverride directive allows webmaster to control user

Common Gateway Interface (CGI) Remember the whole purpose of your web server is to accept requests and return a file Remember the whole purpose of your web server is to accept requests and return a file  Can be a static text file or generated by another executable program Important portion of a request is METHOD Important portion of a request is METHOD  Tells the server how to handle the incoming data

HTTP Methods GET – returns the data asked for GET – returns the data asked for HEAD – returns the headers a GET would have but without the data HEAD – returns the headers a GET would have but without the data POST – tells the server to accept data and do something with it using the CGI POST – tells the server to accept data and do something with it using the CGI PUT – tells the server to store the data PUT – tells the server to store the data

HTTP Methods (continued) DELETE – tells the server to delete the data DELETE – tells the server to delete the data TRACE – tells the server to return a diagnostic of the actions taken TRACE – tells the server to return a diagnostic of the actions taken CONNECT – used to ask a proxy to make a connection to another host and relay the content rather than parse or cache it. (used to work around SSL connections) CONNECT – used to ask a proxy to make a connection to another host and relay the content rather than parse or cache it. (used to work around SSL connections)

Using a FORM

Writing and Executing Scripts Use ScriptAlias in httpd.conf to point to the location of your executable programs Use ScriptAlias in httpd.conf to point to the location of your executable programs Remember your OS must believe it’s an executable program Remember your OS must believe it’s an executable program  In UNIX this means permissions CGI script consists must generate all the expects HTTP info (header and body) CGI script consists must generate all the expects HTTP info (header and body) Header is separated from body by blank line Header is separated from body by blank line

Writing and Executing Scripts AddHandler method AddHandler method  AddHandler cgi-script cgi Means if the server comes across a document with the extension.cgi it wil be taken to be an executable script Means if the server comes across a document with the extension.cgi it wil be taken to be an executable script Not a good method in practice unless you trust your users and developers Not a good method in practice unless you trust your users and developers

Script Directives ScriptAlias urlpath directory ScriptAlias urlpath directory ScriptAliasMatch regex directory ScriptAliasMatch regex directory ScriptLog filename ScriptLog filename ScriptLogLength # of bytes ScriptLogLength # of bytes ScriptLogBuffer # of bytes ScriptLogBuffer # of bytes

Unix specific Script Directives RlimitCPU # or max, # or max RlimitCPU # or max, # or max  CPU Cycles: Soft limit, hard limit RLimitMEM # or max, # or max RLimitMEM # or max, # or max  Bytes of Memory: Soft, hard limit RLimitNROC #or max, # or max RLimitNROC #or max, # or max  # of Processes per user limits

Wrappers for Scripts Scripts present a security risk if not constructed properly and carefully Scripts present a security risk if not constructed properly and carefully On Unix a “wrapper” is used to encase the script and protect the rest of the system On Unix a “wrapper” is used to encase the script and protect the rest of the system Unix uses suEXEC which changes the permissions given to an executable program Unix uses suEXEC which changes the permissions given to an executable program

Handlers Performs certain actions when a file with a particular MIME or handler type is called Performs certain actions when a file with a particular MIME or handler type is called send-as-is : sends the file with headers send-as-is : sends the file with headers cgi-script : executes the file cgi-script : executes the file imap-file : uses the file as an imagemap imap-file : uses the file as an imagemap server-parsed : parses server-side includes server-parsed : parses server-side includes AddHandler cgi-script cgi pl AddHandler cgi-script cgi pl