From owner-freebsd-doc@FreeBSD.ORG Fri Jul 30 15:01:34 2004 Return-Path: Delivered-To: freebsd-doc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 78EAC16A4CE for ; Fri, 30 Jul 2004 15:01:34 +0000 (GMT) Received: from watcher.puryear-it.com (ip-66-186-248-99.static.eatel.net [66.186.248.99]) by mx1.FreeBSD.org (Postfix) with ESMTP id B97AE43D45 for ; Fri, 30 Jul 2004 15:01:33 +0000 (GMT) (envelope-from dpuryear@usa.net) Received: from localhost (unknown [127.0.0.1]) by watcher.puryear-it.com (Postfix) with ESMTP id AD3E334D6D for ; Fri, 30 Jul 2004 09:59:17 -0500 (CDT) Received: from watcher.puryear-it.com ([127.0.0.1]) by localhost (watcher.puryear-it.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 96585-07 for ; Fri, 30 Jul 2004 09:59:15 -0500 (CDT) Received: from THEBOX (localhost [127.0.0.1]) by watcher.puryear-it.com (Postfix) with SMTP id CCCDE34D6A for ; Fri, 30 Jul 2004 09:59:14 -0500 (CDT) Message-ID: <015e01c47646$0f01c8e0$0200a8c0@THEBOX> From: "Dustin Puryear" To: Date: Fri, 30 Jul 2004 10:01:03 -0500 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0157_01C4761C.1FABC850" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Virus-Scanned: by amavisd-new X-Content-Filtered-By: Mailman/MimeDel 2.1.1 Subject: 23.7 Apache HTTP Server - review X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2004 15:01:34 -0000 This is a multi-part message in MIME format. ------=_NextPart_000_0157_01C4761C.1FABC850 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit This edit was performed in Word2k. The output is HTML. --- Puryear Information Technology, LLC Baton Rouge, LA 225-706-8414 http://www.puryear-it.com Author of "Best Practices for Managing Linux and UNIX Servers" Download your free copy: http://www.puryear-it.com/bestpractices_ebook.htm ------=_NextPart_000_0157_01C4761C.1FABC850 Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="network-apache.html" MIME-Version: 1.0 Content-Type: text/plain; name="network-apache.html" FreeBSD Handbook [1]Prev Chapter 23 Network Servers [2]Next _________________________________________________________________ 23.7 Apache HTTP = Server Contributed by Murray Stokely. 23.7.1 Overview FreeBSD is used to run some of the busiest web sites in the world. = The majority of web servers on the Internet are using the Apache HTTP = Server. Apache software packages should be included on your FreeBSD = installation media in the ports package. If you = did not install Apache when you first installed FreeBSD, then you can = install it from the [3]= www/apache13 or = [4]<= tt>www/apache2 = port. Once Apache has been installed successfully, it must be = configured. Note: This section covers version 1.3.X of the Apache HTTP = Server as that is the most widely used version for FreeBSD. Apache 2.X = introduces many new technologies but they are not discussed here. For more information = about Apache 2.X, please see [5]http://httpd.apache.org/. 23.7.2 Configuration The main Apache HTTP Server configuration file is installed as = /usr/local/etc/apache/httpd.conf on FreeBSD. This file is a typical Unix text configuration file with comment lines beginning with the # character. A comprehensive description of all possible configuration = options is outside the scope of this book, so only the most frequently modified = directives will be described here. ServerRoot "/usr/local" This specifies the default directory = hierarchy for the Apache installation. Binaries are stored in the bin and sbin = subdirectories of the server root, and configuration files are stored in etc/apache. ServerAdmin you@your.address The address to which = problems with the server should be emailed. This address appears on some server-generated pages, such as error documents. ServerName www.example.com ServerName = allows you to set a host name which is sent back to clients for your server if it is different to the one that the host is configured with (i.e., use "www" instead of the host's real name). This address must be setup in your DNS and be resolvable by the = client. DocumentRoot "/usr/local/www/data" = ; = &= nbsp; = DocumentRoot: = The directory out of which you will serve your documents. By default, all = requests are taken from this directory, but symbolic links and aliases may be = used to point to other locations. It is always a good idea to make backup copies of your Apache = configuration file before making changes (RCS works well = for this task--read about RCS ). Once you are satisfied with your = initial configuration you are ready to start running = Apache. 23.7.3 Running Apache Apache does not run from the inetd super server as many other network servers do. It is configured to run standalone for better performance for incoming HTTP requests from client = web browsers. A shell script wrapper is included to make starting, stopping, = and restarting the server as simple as possible. To start up Apache = for the first time, just run: # /usr/local/sbin/apachectl start You can stop the server at any time by typing = : # /usr/local/sbin/apachectl stop After making changes to the configuration file for any reason, you = will need to restart the server: # /usr/local/sbin/apachectl restart To launch Apache at system startup, add the following line to = /etc/rc.conf: apache_enable=3D"YES" If you would like to supply additional command line options for the = Apache httpd program started at system boot, you may specify them with an additional = line in rc.conf: apache_flags=3D"" Now that the web server is running, you can view your web site by = pointing a web browser to http://localhost/. The default web page that = is displayed is /usr/local/www/data/index.html. 23.7.4 Apache Modules There are many different Apache modules available to add = functionality to the basic server. The FreeBSD Ports Collection provides an easy way to = install Apache together with some of the more popular add-on modules. 23.7.4.1 mod_ssl= The mod_ssl module uses the OpenSSL library to provide strong cryptography via the Secure Sockets Layer (SSL = v2/v3) and Transport Layer Security (TLS v1) protocols. This module provides everything necessary to request a signed certificate from a trusted = certificate signing authority so that you can run a secure web server on = FreeBSD. If you have not yet installed Apache, then a version of Apache = that includes mod_ssl may be installed with the = [6]www/apache13-modssl<= /a> port. 23.7.4.2 mod_perl The Apache/Perl integration project brings together the full power of = the Perl programming language and the Apache HTTP server. With the mod_perl module it is possible to write Apache = modules entirely in Perl. In addition, the persistent interpreter embedded in = the server avoids the overhead of starting an external interpreter and the = penalty of Perl start-up time. If you have not yet installed Apache, then a version of Apache = that includes mod_perl may be installed with the = [7]www/apache13-modperl= port. If you have already installed = www/apache13 then use the www/mod_perl port, which will add = the mod_perl functionality to an existing Apache = installation. [**NOTE FROM DUSTIN - PERSONALLY, I PREFER = INSTALLING WWW/APACHE13 AND THEN MOD_PERL, NOT WWW/APACHE13-MODPERL.**] 23.7.4.3 = PHP PHP, which stands for ``PHP: Hypertext Preprocessor'' is a = widely-used Open Source general-purpose scripting language that is especially suited for = Web development and can be embedded into HTML. Its syntax draws upon C, = Java, and Perl, and is easy to learn. The main goal of the language is to allow = web developers to write dynamically generated webpages quickly, but you can do much more with PHP. PHP may be installed from the [8]lang/php5 = port. /note PHP requires that www/apache13 be = installed. This is normally a reasonable assumption, but not always. You may have installed a variation of the www/apache13 port, such as = www/apache13-modssl, instead. When installing PHP with an apache13 other than www/apache13 = you should specify the port you used using the APACHE_PORT Make = flag. /end-note _________________________________________________________________ [9]Prev [10]Home [11]Next Domain = Name System (DNS) [12]Up File Transfer Protocol (FTP) This, and other documents, can be downloaded from [13]ftp://ftp.FreeBSD.org/pub= /FreeBSD/doc/. For questions about FreeBSD, read the [14]documentation before contacting <[15]questions@FreeBSD.org>. For questions about this documentation, e-mail <[16]doc@FreeBSD.org>. References 1. 3D"http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network= 2. 3D"http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network= 3. 3D"http://www.freebsd.org/cgi/url.cgi?ports/www/apache13/pkg-descr" 4. 3D"http://www.freebsd.org/cgi/url.cgi?ports/www/apache2/pkg-descr" 5. 3D"http://httpd.apache.org/" 6. 3D"http://www.freebsd.org/cgi/url.cgi?ports/www/apache13-modssl/pkg-= 7. 3D"http://www.freebsd.org/cgi/url.cgi?ports/www/apache13-modperl/pkg= 8. 3D"http://www.freebsd.org/cgi/url.cgi?ports/lang/php5/pkg-descr" 9. 3D"http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network= 10. 3D"http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/index.h= 11. 3D"http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network= 12. 3D"http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network= 13. 3D"ftp://ftp.freebsd.org/pub/FreeBSD/doc/" 14. 3D"http://www.freebsd.org/docs.html" 15. 3D"mailto:questions@FreeBSD.org" 16. 3D"mailto:doc@FreeBSD.org" ------=_NextPart_000_0157_01C4761C.1FABC850--