|
|
|||||||||||||||||||||||||
Beginners Start Here!IntroductionSo you have downloaded Apache for your OS. Where do you install it? Some suggestions for Unix users are:
Deciding where to locate Apache and its configuration files is still a problem if you are installing Apache from the source code.
Once the binary has been located, it is relatively easy to locate the remaining components we need access to to configure and run Apache. httpd [ -d serverroot ] [ -f config ] [ -C directive ] [ -c directive ] [ -D parameter ] [ -e level ] [ -E file ] [ -k start|restart|graceful|stop ] [ -R directory ] [ -h ] [ -l ] [ -L ] [ -S ] [ -t ] [ -v ] [ -V ] [ -X ] The -V option prints the compile options, two of which are HTTPD_ROOT and SERVER_CONFIG_FILE, which allow us to locate the Apache configuration files. The NT distribution defaults to c:\Program Files\Apache You should override this default and install it in C:\Apache. Why? If you want to run Apache as an NT service you need to install in c:\Apache (see Apache Week). Running it as a NT service lets us start and stop apache with the control panel.
PrerequisitesTo run Apache on your system you have to have installed TCP/IP. Don't even think about proceeding any further until you have completed this installation. The installation of the TCP/IP protocol on your system is outside the scope of this document. Check you system manuals for instructions.
Gosh! Back in the bad old days when I first created the RTFM, TCP/IP was an option. I don't know of any OS that doesn't include it now. Once TCP/IP is running, you need to determine either:
Initial ConfigurationNow that it's been installed somewhere on your system, you need to do some configuration before trying to start Apache. Get out your favorite text editor, and edit the httd.conf file in the .../apache/conf directory. You need to change the following lines:
Before version 1.3.3, there were three configuration files,
srm.conf, access.conf, and httpd.conf.
Three separate configuration files were difficult to justify, particularly when there was a large overlap of information between them. By version 1.3.3 the configuration information was officially combined into a single file (httpd.conf) but beware some distributions still use multiple files. The release notes for both version 2.0 and 2.2 have notes regarding "simplified configuration". Different solutions to "simplified configuration" are reached, depending on which Linux distribution and/or build configuration is used. Some distributions, such as Red Hat, continue to use a single configuration file, targeted a running a single instance, non-virtualized web server. In contrast, Ubuntu has opted to use virtual hosts in the initial configuration and separate configuration directives into logical gropings, with separate sub-directories for these directives.
From: | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| To: | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
|
If you installed Apache in /var/apache. ServerRoot should be
set to the directory where you installed Apache. In the case of NT change ServerRoot to: | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
|
The only other change required it to set the ServerName or the BindAddress. If you have a valid DNS name for your server, change: | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
|
To: | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
|
You should use your own DNS name in place of www3.jlk.net If you only have an IP address, you need to set BindAddress from: | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| To: | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
|
You should change 194.70.74.8 to your own IP address. Save the file and
exit your editor.
Finally you need to configure the location for your html documents. Edit srm.conf and change: | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| To: | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
The above example, it for NT. Unix users would, for example change
DocumentRoot to /var/apache/htdocs.
Save the file and exit your editor.
Starting ApacheA summary of the startup options is included in your documentation for from the Apache web site. The -d option is only one we need at this time.Example: If we have installed Apache in /var/apache the the command line to start the server is: | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| Any problems should show up as error messages when you try to start Apache. Unix users should note, that you must be "root" Uid=0 to run Apache with this default configuration since Apache attempts to bind to Port 80, the default httpd protocol port. If you are "root" you will need to change the Port option in your httpd.conf file to a number which is greater than 1023. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| If you do need to change the Port, the URL for you top level page will need to include the port number in it. Example: if www.jlk.net were running with the above Port configuration, the URL would be: | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
|
NT users need to start Apache with the -i option. Open a dos box, change directories to c:\apache; | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
|
You will then be able to start and stop Apache from the Services element
of the Control Panel.
| ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
|
Note: Each time you make a change to any of the configuration files, you must get Apache to re-read them. Unix users can accomplish this with the -HUP signal. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
On NT, you will have to stop and re-start Apache with the control pannel.
On the current 1.3b3 release, Apache can take several minutes to stop.
Therefore. during development, you might want to consider running Apache
from a dos box as it is quicker to shutdown and restart. Your mileage
may vary.
ReferencesGeneralApache DirectivesOther OptionThere is one option should set when beginning to configure Apache. You should add the e-mail address of the person responsible for the configuration of your server. When certain error occur when a page is request, Apache may inform the browser, with a default error message. Generally this occurs when you have a link to a page which does not exist. The e-mail address of your administrator will be displayed in the error message. You should configure this persons e-mail address with the ServerAdmin option. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| By default your access and error log files and the Apache process id live in the .../apache/logs directory. Some operating systems such as BSDI have a central repository of system log files or system process ids. You can control where your log files and the Apache process id are stored with the following directives. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
References |
||||||||||||||||||||||||||