Posts

Apache’s Virtual Hosting Capabilities

When you set up Apache on an Internet host it can respond to an HTTP request for that host. For example, if you set up Apache on a host called server1.doman.com, Apache will serve HTTP requests for this host. However, if you set up your DNS records such that two other hostnames (say www. mycompany-domain.com and www.friendscompanydomain. com) point to the same machine, you can have Apache serve these two domains as virtual Web sites. In such a case www.mycompany-domain.com is considered the primary Web hostname (main server) and the rest of them will be considered as virtual Web site or virtual hosts. Apache allows virtual hosts to inherit configuration from the main server, which makes the virtual host configuration quite manageable in large installations where some contents can be shared. For example, if you decided only to have a central CGI repository and to allow virtual hosts to use the scripts stored there, you do not need to create a ScriptAlias directive in each v...

Configuring Apache Main Server

The main server configuration applies to the default Web site Apache serves. This is the site that will come up when you run Apache and use the server’s IP address or host name on a Web browser. Port The very first directive in this section is the Port directive, which sets the TCP port that Apache listens to for connections. The default value of 80 is the standard HTTP port. If you change this to another number, such as 8080, you can only access the server using a URL such as http://hostname:8080/. You must specify the port number in the URL if the server runs on a nonstandard port. There are many reasons for running Apache on nonstandard ports, but the only good one I can think of is that you do not have permission to run Apache on the standard HTTP port. As a nonroot user you can only run Apache on ports higher than 1024. After you have decided to run Apache by using a port, you need to tell Apache what its user and group names are. User and Group directives The User ...

Configuring Apache

By default, Apache reads a single configuration file called httpd.conf. Every Apache source distribution comes with a set of sample configuration files. In the standard Apache source distribution, you will find a directory called conf, which contains sample configuration files with the -dist extension. The very first step you need to take before you modify this file is to create a backup copy of the original. The httpd.conf file has two types of information: comments and server directives. Lines starting with a leading # character are treated as a comment line; these comments have no purpose for the server software, but they serve as a form of documentation for the server administrator. You can add as many comments as you want; the server simply ignores all comments when it parses the file. Except for the comments and blank lines, the server treats all other lines as either complete or partial directives. A directive is like a command for the server. It tells the server t...

Why PHP?

We expect our readers to have a more than firm handle on what PHP is, but for completeness-sake: PHP (a recursive acronym of PHP: Hypertext Preprocessor) is an open source, server-side web-scripting language for creating dynamic web pages. Outside of it being browser independent, it offers a simple and universal cross-platform solution for e-commerce, and complex web and database-driven applications. PHP has: A low, smooth learning curve. Broad functionality for databases, strings, network connectivity, file system support, Java, COM, XML, CORBA, WDDX, and Macromedia Flash. Platform compatibility with UNIX (all variants), Win32 (NT/95/98/2000), QNX, MacOS (WebTen), OSX, OS/2, and BeOS. Server compatibility for Apache module (UNIX, Win32), CGI/FastCGI, thttpd, fhttpd, phttpd, ISAPI (IIS, Zeus), NSAPI (Netscape iPlanet), Java servlet engines, AOLServer, and Roxen/Caudium module. A rapid development cycle. New versions with bug fixes, additional functionality, and other i...

HTML Is Not Programming

Image
You might be a little intimidated by all these acronyms, abbreviations, and specifications-speak. Don’t be. Heck, I had to look most of that stuff up as I was writing this, just to make sure I was up-to-date! In most cases, HTML and XHTML concepts are surprisingly simple after you have the basic sense of the way the markup works. It may be comforting to keep repeating to yourself that HTML isn’t anywhere near as complex as programming. Whereas programming is the process of creating scripts or applications using complicated computer languages such as C++ or Java, creating Web pages is generally referred to as authoring. That’s because most of what you’re doing is simply entering text, and then adding codes in and around that text to organize it on the page. From there, you add elements that cause images or multimedia to appear on the page, or elements that make the page look better. That’s what a good portion of this book deals with and it’s all you need to know to put toge...

HTML Versus XHTML

As you’ve seen, HTML is a markup language designed to combine text, multimedia, and hyperlinks to create a Web page. HTML is also a moving target, though, because several different versions have been introduced since it first appeared in the early 1990s. Although each version has built upon the last, and most Web browsers are designed to be “backward-compatible” with previous versions, it’s important to know something about current and future versions of HTML. The World Wide Web Consortium is responsible for creating the specifications that other companies adhere to (for the most part) when creating such things as Web browser applications and devices for viewing Web pages. The W3C is an industry group, founded by Tim Berners-Lee, that includes most of the major players in the corporate world of Web development (such as Microsoft, Netscape, AOL, and AT&T). One of the tasks the W3C undertakes is maintaining the HTML specification. Because technology is always changing, ...

How the Web Works

The World Wide Web isn’t a particular place on the Internet, nor is it a particular computer or something that you can “log into.” Instead, the best way to describe the Web is as a service on the Internet. Using certain protocols, computers that are designated as Web server computers—because they’re connected to the Internet and run Web server software—can respond to requests from client computers running Web browser software. Every computer on the Internet has an address. When a request comes into a Web server computer from a particular address, it responds by sending the requested file back to that address. When the browser application receives that file, it reacts accordingly, generally by displaying the file as a Web page, image, or multimedia element within the browser’s own window. In other cases, the browser might recognize that it can’t handle the file, so it hands it off to a helper application or saves the file in a designated place on the client computer’s hard ...