Web Concepts

Undoubtedly, you are familiar with the Web. Having surfed the Web for fun and profit, you have some understanding of what is meant by a Web browser, a Web page, and a Web site.

Nonetheless, before getting started with Apache, it's important to be clear about some key concepts.

URL—uniform resource locator—is an address on the Web, such as http://www.apache.org

An HTML—hypertext markup language—page is a collection of ASCII content marked with tags. These tags are indicated with brackets: <I am a tag>. Concluding tags are identified with a slash:

<I am a tag> 
I am content 
</I am a tag>

HTML tags provide formatting directives about the content they accompany. Often, they may include parameters, called attributes.

In addition, as Web development has become more complex, tags increasingly are used to delimit scripting content—for example, JavaScript and VBScript—and to house references to executable objects—Java applets and ActiveX controls.

One particularly important HTML tag involves forms. Form data, enclosed by <form> </form> tags, is used to gather user input and send it to the server for processing.

Well-formed HTML pages begin with an <html> tag and end with a </html> tag.

A Web browser is client software designed to decode HTML pages and display the content according to the formatting directives. Modern Web browsers are also expected to execute embedded script commands and instantiate—meaning create a local copy of—referenced objects.

HTTP—Hypertext Transfer Protocol—is a high-level protocol that rides on TCP/IP networks. It is the underlying language that Web clients and servers use to communicate. Essentially, a browser uses HTTP to send a text stream to the server. This text stream takes the form of an HTTP request.

HTTP client requests have three parts:

  • The first line of a request specifies a method and the URL that the client is querying or requesting.

  • The next part of the request contains header information related to the client and the data that it is sending.

  • The final part of the request is its body: a stream of text data.

The three most common HTTP methods are the following:

  • GET, which retrieves a specified URL. For example, clicking an HTML link causes an HTTP GET command to be issued for the URL in the link.

  • HEAD, which obtains information about a document on the server without retrieving it.

  • POST, which sends data to the server for server-side processing.

A Web server is software that listens on a TCP/IP port (or ports) for an HTTP request and responds by returning an HTML page. The default Web server port is 80.

Common gateway interface (CGI) scripts or programs are used on the server side to process data sent via HTTP from a client browser. This data is usually collected in HTML forms. It is then transmitted most commonly as part of a POST command. (When transmitted as part of a GET command, it appears as arguments appended to a URL).

From the viewpoint of the program on the server, CGI data takes the form of pairs, where a given name equals a value.

The output of a CGI server program is usually, but not always, an HTML page that can be transmitted back to the browser.

To activate CGI server program processing, the default Apache distribution that ships with Red Hat Linux 6 needs to be recompiled with appropriate modules following the instructions at the Apache site,

http://www.apache.org

Server-side includes

A server-side include(SSI) is an instruction embedded in an HTML comment that tells the Web server to add something to the HTML page that it is returning to a browser.

Generally, server side includes are used for two purposes:

  • To eliminate repetitive HTML text entry, by enabling all HTML pages that use a standardized HTML code block to invoke the same SSI

  • To enable server-side processing before a Web page is shipped back to the browser

For example, to publish the current date at the bottom of all the pages of a site, you could enter a server side include along these lines:

Date: <!--#config timefmt="%m/%d/%Y"-->

This would show the date in dd/xx/yyyy format.

To get SSI working, you need to recompile Apache with the correct module, mod_include.o. Additionally, either by editing httpd.conf or using the Linux Configuration applet, you need to enable SSI on a domain-by-virtual-domain basis.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.74.211