Chinaunix首页 | 论坛 | 博客
  • 博客访问: 146740
  • 博文数量: 58
  • 博客积分: 1584
  • 博客等级: 上尉
  • 技术积分: 605
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-12 10:06
文章分类

全部博文(58)

文章存档

2011年(7)

2010年(51)

我的朋友

分类: LINUX

2010-05-08 14:02:28

Compiling and Installing Apache 1.3

This document covers compilation and installation of Apache on Unix systems. For compiling and installation on other platforms, see

You may download the latest version of Apache either directly from the .

Like all good things, there are two ways to configure, compile, and install Apache. You can go for the 3-minute installation process using the APACI process described below; or, you can opt for the same mechanism used in previous versions of Apache, as described in the file 'src/INSTALL'. Each mechanism has its benefits and drawbacks - APACI is newer and a little more raw, but it gets you up and running the least amount of time, whereas the "Configuration.tmpl" mechanism may be more familiar and give you some more flexibility to the power user. We'd be very interested in your comments and feedback regarding each approach.

Overview for the impatient

     $ ./configure --prefix=PREFIX
     $ make
     $ make install
     $ PREFIX/bin/apachectl start

NOTE: PREFIX is not the string "PREFIX". Instead use the Unix filesystem path under which Apache should be installed. For instance use "/usr/local/apache" for PREFIX above.

The following requirements exist for building Apache:

Disk Space:
Make sure you have approximately 12 MB of temporary free disk space available. After installation Apache occupies approximately 3 MB of disk space (the actual required disk space depends on the amount of compiled in third party modules, etc).
ANSI-C Compiler:
Make sure you have an ANSI-C compiler installed. The GNU C compiler (GCC) from the Free Software Foundation (FSF) is recommended (version 2.7.2 is fine). If you don't have GCC then at least make sure your vendors compiler is ANSI compliant. You can find the homepage of GNU at and the GCC distribution under order/ftp.html .
Perl 5 Interpreter [OPTIONAL]:
For some of the support scripts like `apxs' or `dbmmanage' (which are written in Perl) the Perl 5 interpreter is required (versions 5.003 and 5.004 are fine). If no such interpreter is found by APACI's `configure' script this is no harm. Of course, you still can build and install Apache 1.3. Only those support scripts cannot be used. If you have multiple Perl interpreters installed (perhaps a Perl 4 from the vendor and a Perl 5 from your own), then it is recommended to use the --with-perl option (see below) to make sure the correct one is selected by APACI.
Dynamic Shared Object (DSO) support [OPTIONAL]:

To provide maximum flexibility Apache now is able to load modules under runtime via the DSO mechanism by using the pragmatic dlopen()/dlsym() system calls. These system calls are not available under all operating systems therefore you cannot use the DSO mechanism on all platforms. And Apache currently has only limited built-in knowledge on how to compile shared objects because this is heavily platform-dependent. The current state is this:

  • Out-of-the-box supported platforms are:

    LinuxSunOSUnixWareDarwin/Mac OS
    FreeBSDSolarisAIXOpenStep/Mach
    OpenBSDIRIXSCODYNIX/ptx
    NetBSDHPUXReliantUNIXBSDI
    Digital UnixDGUX

  • Entirely unsupported platforms are:

    Ultrix

If your system is not on these lists but has the dlopen-style interface, you either have to provide the appropriate compiler and linker flags (see CFLAGS_SHLIB, LDFLAGS_SHLIB and LDFLAGS_SHLIB_EXPORT below) manually or at least make sure a Perl 5 interpreter is installed from which Apache can guess the options.

For more in-depth information about DSO support in Apache 1.3 please read the document htdocs/manual/dso.html carefully. Especially the section entitled "Advantages & Disadvantages" because using the DSO mechanism can have strange side-effects if you are not careful. BE WARNED!

The next step is to configure the Apache source tree for your particular platform and personal requirements. The most important setup here is the location prefix where Apache is to be installed later, because Apache has to be configured for this location to work correctly. But there are a lot of other options available for your pleasure.

For a short impression of what possibilities you have, here is a typical example which compiles Apache for the installation tree /sw/pkg/apache with a particular compiler and flags plus the two additional modules mod_rewrite and mod_proxy for later loading through the DSO mechanism:

     $ CC="pgcc" OPTIM="-O2" \
       ./configure --prefix=/usr/local/apache \
                   --enable-module=rewrite --enable-shared=rewrite \
                   --enable-module=proxy   --enable-shared=proxy

For a complete list of the available options, type the following command:

./configure --help

See also the file README.configure for listings of example configurations.

Now you can build the various parts which form the Apache package by simply running the command

        $ make 

Please be patient here, this takes approximately 2 minutes to complete under a Pentium-166/FreeBSD-2.2 system, dependent on the amount of modules you have enabled.

Now its time to install the package under the configured installation PREFIX (see the --prefix option above):

        $ make install

In the following examples, PREFIX is not the literal string "PREFIX", but whatever argument you provided to the--prefix option.

Before the advent of APACI, there was just one way to build and install Apache. While APACI gave a configuration interface which is more familiar to some people, the older method gives a way to configure the installation without typing a large number of command-line options.

Compiling Apache consists of three steps: First select which Apache modules you want to include into the server. Second create a configuration for your operating system. Third compile the executable.

All configuration of Apache is performed in the src directory of the Apache distribution. Change into this directory.

  1. Select modules to compile into Apache in the Configuration file src/Configuration.tmpl. Uncomment lines corresponding to those optional modules you wish to include (among the AddModule lines at the bottom of the file), or add new lines corresponding to additional modules you have downloaded or written. (See  for preliminary docs on how to write Apache modules). Advanced users can comment out some of the default modules if they are sure they will not need them (be careful though, since many of the default modules are vital for the correct operation and security of the server).

    You should also read the instructions in the Configuration file to see if you need to set any of the Rule lines.

  2. Configure Apache for your operating system. Normally you can just run the Configure script as given below. However if this fails or you have any special requirements (e.g., to include an additional library required by an optional module) you might need to edit one or more of the following options in theConfiguration file: EXTRA_CFLAGS, LIBS, LDFLAGS, INCLUDES.

    Run the Configure script:

        % Configure
        Using 'Configuration' as config file
         + configured for  platform
         + setting C compiler to  *
         + setting C compiler optimization-level to  *
         + Adding selected modules
         + doing sanity check on compiler and options
        Creating Makefile in support
        Creating Makefile in main
        Creating Makefile in os/unix
        Creating Makefile in modules/standard
      
    
    (*: Depending on Configuration and your system, Configure might not print these lines. That's OK).

    This generates a Makefile for use in stage 3. It also creates a Makefile in the support directory, for compilation of the optional support programs.

    (If you want to maintain multiple configurations, you can give an option to Configure to tell it to read an alternative Configuration file, such asConfigure -file Configuration.ai).

  3. Type make.
The modules we place in the Apache distribution are the ones we have tested and are used regularly by various members of the Apache development group. Additional modules contributed by members or third parties with specific needs or functions are available at <>. There are instructions on that page for linking these modules into the core Apache code.

You will have a binary file called httpd in the src directory. A binary distribution of Apache will supply this file.

The next step is to install the program and configure it. Apache is designed to be configured and run from the same set of directories where it is compiled. If you want to run it from somewhere else, make a directory and copy the conflogs and icons directories into it. In either case you should read thesecurity tips describing how to set the permissions on the server root directory.

The next step is to edit the configuration files for the server. This consists of setting up various directives in up to three central configuration files. By default, these files are located in the conf directory and are called srm.confaccess.conf and httpd.conf. To help you get started there are same files in the conf directory of the distribution, called srm.conf-distaccess.conf-dist and httpd.conf-dist. Copy or rename these files to the names without the -dist. Then edit each of the files. Read the comments in each file carefully. Failure to setup these files correctly could lead to your server not working or being insecure. You should also have an additional file in the conf directory called mime.types. This file usually does not need editing.

First edit httpd.conf. This sets up general attributes about the server: the port number, the user it runs as, etc. Next edit the srm.conf file; this sets up the root of the document tree, special functions like server-parsed HTML or internal imagemap parsing, etc. Finally, edit the access.conf file to at least set the base cases of access.

In addition to these three files, the server behavior can be configured on a directory-by-directory basis by using .htaccess files in directories accessed by the server.

Compiling Support Programs

In addition to the main httpd server which is compiled and configured as above, Apache includes a number of support programs. These are not compiled by default. The support programs are in the support directory of the distribution. To compile the support programs, change into this directory and type
    make

Now you can fire up your Apache HTTP server by immediately running

        $ PREFIX/bin/apachectl start

and then you should be able to request your first document via URL (when you built and installed Apache as root or at least used the --without-confadjust option) or (when you built and installed Apache as a regular user). Then stop the server again by running:

        $ PREFIX/bin/apachectl stop

Proper operation of a public web server requires accurate time keeping, since elements of the HTTP protocol are expressed as the time of day. So, it's time to investigate setting up NTP or some other time synchronization system on your Unix box, or the net time command on NT.





出现的问题与解决方案:
1.安装完apache,重启APACHE老出现httpd: Could not reliably determine the server's fully qualified domain name

解决方案:

进入apache的安装目录,我的是D:\Program Files\Apache Software Foundation\Apache2.2\conf

用记事本打开httpd.conf

将里面的#ServerName 注释去掉即可,,并改成ServerName 127.0.0.1:80。

再执行httpd

重启APACHE后就不会出现那个提示了.


只能出现sudo 才能启动输入这个网址 itworks 的话 就说明apache工作了!

阅读(1021) | 评论(2) | 转发(0) |
0

上一篇:时间格式化函数strftime

下一篇:动态规划

给主人留下些什么吧!~~

chinaunix网友2010-05-08 14:05:24

mht@mht-laptop:/$ /etc/httpd/bin/apachectl start httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName (13)Permission denied: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs

chinaunix网友2010-05-08 14:04:52

mht@mht-laptop:/$ /etc/httpd/bin/apachectl start httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName (13)Permission denied: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs