Sunteți pe pagina 1din 28

Copyright 2000 by Joe Cooper

Compiled by: Clint Pate MCSE/CNA @Swelltech.com & Apache.org

Download & Install


The setting up of an Apache Web server falls naturally into a number of steps. Unfortunately, the steps differ slightly depending upon whether you're going to be using a binary distribution or if you're using Windows; the steps that may not apply are marked as 'optional' below. Download the software [optional] Build the software (unless you downloaded a binary distribution) Stop any currently-running Apache server [optional] De-install any existing Apache package (Windows only) Install the new Apache software Make sure the configuration is correct Start the Web server Customise your content

Prebuilt Packages--or Building Your Own


Since

Apache is developed as an Open Source' project, you have a choice of either using a package that someone else prepared for your platform (distro) or of downloading the source and building it yourself from the ground up. Of course, with the dozens of available platforms, there are sure to be some to which the Apache developers themselves don't have access, and so your options may actually be reduced to building the Apache Web server from scratch yourself.

Downloading the Software


Downloading There

the latest version.

<URL:http://www.apache.org/dist/>

are two types of packages you can download from the Apache site:
Packages containing only the Web server source code. Packages containing the source code and a prebuilt binary. (RPMs)

Building the Software from Source


If

you want or need to build Apache from source, you can use the following commands as a quick-start. You should download the latest released version of the Apache tarball and unpack it into a working directory. Then make and install the package.

Installing Apache RPM


This

is perhaps the simplest option of all. Once you've acquired the RPM file (which you have to get from some other location than the Apache distribution site; the Apache Software Foundation doesn't distribute RPM files), you can just 'make it so' by being logged in as root and issuing the following command from the directory where the Apache RPM file is located:
# rpm -Uvh apache*

You

have no choice where to put files!

Verifying the ServerName


If your system is named "www.cns.tstc.edu", then that's what you should put on the ServerName directive line. You can find its fully-qualified name by simply typing "hostname" at the shell prompt. The result should look something like this: For the very best results, you should verify that the ServerName directive in your httpd.conf file matches your system's actual fully-qualified domain name. <prompt>$ hostname
www.foo.bar.com If it only displays a partial name (like "www"), you need to find out the correct domain name and put the two together.

Validating Apache Config Files


The

last thing to do before starting up your new Apache installation is to make sure it's configured properly. On a Unix system, you do this with the following command:
<prompt> $ /usr/local/web/apache/bin/apachectl configtest <the system replies> Syntax OK

If

there's anything syntactically wrong with your configuration files, you'll get an error message describing the problem. But from a vanilla installation everything should be healthy.

Start and Stop Apache


/usr/local/web/apache/bin/apachectl

start /usr/local/web/apache/bin/apachectl stop

CHANGE THE MAIN PAGE!


By

default, following an Apache installation the main page in your DocumentRoot directory will say something reassuring -- to you -- about the success of the installation. It's sort of like the ReadMe.txt file you get to see after installing an application on Windows box. Now your ready for site content: replace the default index.html* file (or files) with something of your own or for your company/business. If you dot change it people will think they have installed Apache.

Reloading After Changes


Whevever

you make changes to the server configuration files (such as httpd.conf, they won't take effect until the server is restarted and reloaded. On Unix, the command to do this is: <prompt> $ /usr/local/web/apache/bin/apachectl graceful

Apache Webserver Webmin

The Apache module is broken up into several sections to address different aspects of an Apache configuration. On the main page, these sections are grouped into

In the context of the Apache module, It is usually unnecessary to run more than one httpd daemon on a single machine, but it is possible, and it is also possible to manage more than one such daemon with Webmin via the module cloning feature.

Global Configuration. Global Configuration refers to configuration information that will apply to all virtual servers that are run from the same httpd daemon. Virtual Servers groups. Virtual servers is the method used to locate several web sites, with unique domain names, on a single IP address, in order to conserve the rapidly diminishing IPv4 name space that is available.

Global Configuration

Processes and Limits


This page provides the following options, which set many of the limits for Apache.
Maximum headers in request -- Sets the maximum headers per request. Maximum request header size - Defines the maximum header size that will be permitted. Maximum request line size - Defines the maximum length of a HTTP requestline. Maximum concurrent requests - The maximum number of allowed concurrent requests. Maximum requests per server process - The maximum number of requests that each child process will answer before being killed and respawned. Maximum spare server processes - This defines the maximum number of unused server processes that will be left running. Minimum spare server processes - The minimum number of child processes that will be left running. Initial server processes - The number of child processes that are spawned when the httpd is started. Display extended status information - If the status modules is enabled on the server, turning this on will keep track of extended status information for each request.

Networking and Addresses

This section is for configuring the network addresses and ports where Apache will listen, and some other access limit, timeout, and queue options.

Networking and Addresses

Listen on addresses and ports - This option defines the addresses and ports where Apache will listen for requests. Multiple requests per connection - When KeepAlive is enabled, this sets the maximum number of requests to be handled per client connection. Keep-alive timeout - The number of seconds Apache will wait for a subsequent request before closing a connection. Listen queue length - The maximum length of the queue of pending connections. Addresses for name virtual servers - This option is used to configure the address on which Apache will listen for requests to virtual servers. Virtual servers are name based servers, wherein several different host or domain names can answer on the same IP address. TCP send buffer size - Sets the size of the send buffer for TCP packets. Request timeout - Defines the maximum number of seconds that Apache will wait for a request after a connection has been established.

Apache Module

Apache is designed in a modular fashion, so that the base server can be a small easily debugged application, while nearly unlimited additional functionality can be added easily by loading additional modules. The base process can then be smaller, and only those additional features that are needed can be loaded. This module allows you to select the available modules that you'd like to be loaded.

Apache Modules Page


The

first module listed in the figure above is mod_so, which is the module that provides shared object loading at run-time. This module is required if you are using run-time module loading. Dynamic Shared Objects are not supported by all operating systems. There are several other modules in common use listed in the above figure. The best place to go to find out more about available standard modules and third party modules is Apache modules and Apache Module Registry.

MIME Types
MIME

Types is the method by which the server, and its clients, know what type of data a given object is. This information is generally more important to the client, as they must know how to interpret the data where the server only needs to send it to the client along with MIME identification information.

Apache MIME Types


or Multipurpose Internet Mail Extensions was originally defined to easily allow sending of data other than text via email. It has now become the standard method for many types of network connection to declare data type. The MIME Types module merely provides a list of the currently accepted MIME types, and their optional extensions. At the bottom of the page, the Add a MIME type link allows you to add new MIME types easily.
MIME,

Miscellaneous
The

Miscellaneous options page is just what it sounds like. It's the global options that didn't seem to fit anywhere else. As such, there aren't very many fields on this page, but nonetheless there are a few items of interest.

Apache Miscellaneous Page


Core dump directory - This is the directory where Apache will send its core dump file, in the event of a crash. Server lock file - This sets the location for Apache's lock file to the file named. A lock file is the file that is used to notify a new instance of a process that one is already running. Server PID file - The PID file for Apache. Shared memory scoreboard file - Some architectures require a file for the children and parent processes can communicate. Server execution - Defines how the server will be started. Standalone indicates that it will run as a standalone daemon, while Run from inetd will cause it to run periodically, as called by the inetd daemon (not recommended).

CGI Programs

CGI, or Common Gateway Interface, provides a means for a website to have dynamic, program generated, content on a web page. CGI programs can interact with the user through the use of input fields and can provide different data based on the information returned. CGI programs can be written in nearly any language, though it is most common for them to be written in Perl, PHP, Python, Java, C, and bash or other shell scripting languages. The CGI Programs module provides an interface to the global CGI options of Apache.

Apache CGI Programs Page


CGI Script log - Is the log directory for the CGI script error log file. Maximum logged post data size - Data from a PUT or POST request to a CGI script that is written to the error logfile can be limited in size, because PUT and POST requests can be extremely large. Maximum CGI log post size - Limits the size of the CGI script logfile. Variables set based on browser type - If the server should set some environment variables differently depending on the client browser type, it is possible to enter that data here. Variable set based on request headers - Allows you to set environment variables based on attributes of the request.

Per-Directory Options Files

Apache offers the ability to modify many global settings on a per-directory basis. This module provides access to that feature. To create an options file for a directory, simply enter the path and filename in the field and click Create Options File. By convention these files are called .htaccess, but that is a configurable option in Apache. This file also allows for simple password authentication among other access control features.

Virtual Servers
The

lower half of the Apache page contains a list of configured virtual servers. Each virtual server entry on this page shows the address and port the virtual server listens on, the server name, and the document root.

Server Configuration

This page allows you to reconfigure the basic configuration details of your virtual server. For example, if when you created your virtual server you placed it on port 8080 for testing, but now want to move it over to port 80 for production, you can perform that update here. Address and Port - If your system has multiple interfaces, Apache will answer on any of them by default on port 80. However, you can configure your virtual server to only answer on one address using this option. You can also configure a different port here. Document Root - This is the root directory, from whence the paths to access objects on your server will begin. This option configures the DocumentRoot directive. Server Name - When using name based virtual servers, this name should match the name under which this server should answer. This is also used when creating redirection URLs. If not specified Apache will try to deduce it from the IP address, which isn't always reliable. This option correlates to the ServerName directive.

Apache Tutorials

The following site ref gives you step-by-step instructions on how to accomplish common tasks with the Apache http server.
http://httpd.apache.org/docs /misc/tutorials.html

Make sure to secure your Apache server!


Apache-SSL http://www.apache-ssl.org/

S-ar putea să vă placă și