📄 install.html.en
字号:
download site</a>, which lists several mirrors. Most users of Apache HTTPd on unix-like systems will be better off downloading and compiling a source version. The build process (described below) is easy, and it allows you to customize your server to suit your needs. In addition, binary releases are often not up to date with the latest source releases. If you do download a binary, follow the instructions in the <code>INSTALL.bindist</code> file inside the distribution.</p> <p>After downloading, it is important to verify that you have a complete and unmodified version of the Apache HTTP Server. This can be accomplished by testing the downloaded tarball against the PGP signature. Details on how to do this are available on the <a href="http://httpd.apache.org/download.cgi#verify">download page</a> and an extended example is available describing the <a href="http://httpd.apache.org/dev/verification.html">use of PGP</a>.</p></div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div><div class="section"><h2><a name="extract" id="extract">Extract</a></h2> <p>Extracting the source from the Apache HTTPd tarball is a simple matter of uncompressing, and then untarring:</p> <div class="example"><p><code> $ gzip -d httpd-<em>NN</em>.tar.gz<br /> $ tar xvf httpd-<em>NN</em>.tar </code></p></div> <p>This will create a new directory under the current directory containing the source code for the distribution. You should <code>cd</code> into that directory before proceeding with compiling the server.</p></div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div><div class="section"><h2><a name="configure" id="configure">Configuring the source tree</a></h2> <p>The next step is to configure the Apache HTTPd source tree for your particular platform and personal requirements. This is done using the script <code class="program"><a href="./programs/configure.html">configure</a></code> included in the root directory of the distribution. (Developers downloading an unreleased version of the Apache HTTPd source tree will need to have <code>autoconf</code> and <code>libtool</code> installed and will need to run <code>buildconf</code> before proceeding with the next steps. This is not necessary for official releases.)</p> <p>To configure the source tree using all the default options, simply type <code>./configure</code>. To change the default options, <code class="program"><a href="./programs/configure.html">configure</a></code> accepts a variety of variables and command line options.</p> <p>The most important option is the location <code>--prefix</code> where the Apache HTTP Server is to be installed later, because Apache HTTPd has to be configured for this location to work correctly. More fine-tuned control of the location of files is possible with additional <a href="programs/configure.html#installationdirectories">configure options</a>.</p> <p>Also at this point, you can specify which <a href="programs/configure.html#optionalfeatures">features</a> you want included in Apache HTTPd by enabling and disabling <a href="mod/">modules</a>. The Apache HTTP Server comes with a <a href="mod/module-dict.html#Status">Base</a> set of modules included by default. Other modules are enabled using the <code>--enable-<var>module</var></code> option, where <var>module</var> is the name of the module with the <code>mod_</code> string removed and with any underscore converted to a dash. You can also choose to compile modules as <a href="dso.html">shared objects (DSOs)</a> -- which can be loaded or unloaded at runtime -- by using the option <code>--enable-<var>module</var>=shared</code>. Similarly, you can disable Base modules with the <code>--disable-<var>module</var></code> option. Be careful when using these options, since <code class="program"><a href="./programs/configure.html">configure</a></code> cannot warn you if the module you specify does not exist; it will simply ignore the option.</p> <p>In addition, it is sometimes necessary to provide the <code class="program"><a href="./programs/configure.html">configure</a></code> script with extra information about the location of your compiler, libraries, or header files. This is done by passing either environment variables or command line options to <code class="program"><a href="./programs/configure.html">configure</a></code>. For more information, see the <code class="program"><a href="./programs/configure.html">configure</a></code> manual page.</p> <p>For a short impression of what possibilities you have, here is a typical example which compiles Apache for the installation tree <code>/sw/pkg/apache</code> with a particular compiler and flags plus the two additional modules <code class="module"><a href="./mod/mod_rewrite.html">mod_rewrite</a></code> and <code class="module"><a href="./mod/mod_speling.html">mod_speling</a></code> for later loading through the DSO mechanism:</p> <div class="example"><p><code> $ CC="pgcc" CFLAGS="-O2" \<br /> ./configure --prefix=/sw/pkg/apache \<br /> --enable-rewrite=shared \<br /> --enable-speling=shared </code></p></div> <p>When <code class="program"><a href="./programs/configure.html">configure</a></code> is run it will take several minutes to test for the availability of features on your system and build Makefiles which will later be used to compile the server.</p> <p>Details on all the different <code class="program"><a href="./programs/configure.html">configure</a></code> options are available on the <code class="program"><a href="./programs/configure.html">configure</a></code> manual page.</p></div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div><div class="section"><h2><a name="compile" id="compile">Build</a></h2> <p>Now you can build the various parts which form the Apache HTTPd package by simply running the command:</p><div class="example"><p><code>$ make</code></p></div> <p>Please be patient here, since a base configuration takes several minutes to compile and the time will vary widely depending on your hardware and the number of modules that you have enabled.</p> </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div><div class="section"><h2><a name="install" id="install">Install</a></h2> <p>Now it's time to install the package under the configured installation <em>PREFIX</em> (see <code>--prefix</code> option above) by running:</p><div class="example"><p><code>$ make install</code></p></div> <p>If you are upgrading, the installation will not overwrite your configuration files or documents.</p></div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div><div class="section"><h2><a name="customize" id="customize">Customize</a></h2> <p>Next, you can customize your Apache HTTP Server by editing the <a href="configuring.html">configuration files</a> under <code><em>PREFIX</em>/conf/</code>.</p><div class="example"><p><code>$ vi <em>PREFIX</em>/conf/httpd.conf</code></p></div> <p>Have a look at the Apache HTTP Server manual under <a href="./">docs/manual/</a> or consult <a href="http://httpd.apache.org/docs/2.2/">http://httpd.apache.org/docs/2.2/</a> for the most recent version of this manual and a complete reference of available <a href="mod/directives.html">configuration directives</a>.</p></div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div><div class="section"><h2><a name="test" id="test">Test</a></h2> <p>Now you can <a href="invoking.html">start</a> your Apache HTTP Server by immediately running:</p><div class="example"><p><code>$ <em>PREFIX</em>/bin/apachectl -k start</code></p></div> <p>and then you should be able to request your first document via URL <code>http://localhost/</code>. The web page you see is located under the <code class="directive"><a href="./mod/core.html#documentroot">DocumentRoot</a></code>, which will usually be <code><em>PREFIX</em>/htdocs/</code>. Then <a href="stopping.html">stop</a> the server again by running:</p> <div class="example"><p><code>$ <em>PREFIX</em>/bin/apachectl -k stop</code></p></div></div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div><div class="section"><h2><a name="upgrading" id="upgrading">Upgrading</a></h2> <p>The first step in upgrading is to read the release announcement and the file <code>CHANGES</code> in the source distribution to find any changes that may affect your site. When changing between major releases (for example, from 1.3 to 2.0 or from 2.0 to 2.2), there will likely be major differences in the compile-time and run-time configuration that will require manual adjustments. All modules will also need to be upgraded to accomodate changes in the module API.</p> <p>Upgrading from one minor version to the next (for example, from 2.2.55 to 2.2.57) is easier. The <code>make install</code> process will not overwrite any of your existing documents, log files, or configuration files. In addition, the developers make every effort to avoid incompatible changes in the <code class="program"><a href="./programs/configure.html">configure</a></code> options, run-time configuration, or the module API between minor versions. In most cases you should be able to use an identical <code class="program"><a href="./programs/configure.html">configure</a></code> command line, an identical configuration file, and all of your modules should continue to work.</p> <p>To upgrade across minor versions, start by finding the file <code>config.nice</code> in the <code>build</code> directory of your installed server or at the root of the source tree for your old install. This will contain the exact <code class="program"><a href="./programs/configure.html">configure</a></code> command line that you used to configure the source tree. Then to upgrade from one version to the next, you need only copy the <code>config.nice</code> file to the source tree of the new version, edit it to make any desired changes, and then run:</p> <div class="example"><p><code> $ ./config.nice<br /> $ make<br /> $ make install<br /> $ <em>PREFIX</em>/bin/apachectl -k graceful-stop<br /> $ <em>PREFIX</em>/bin/apachectl -k start<br /> </code></p></div> <div class="warning">You should always test any new version in your environment before putting it into production. For example, you can install and run the new version along side the old one by using a different <code>--prefix</code> and a different port (by adjusting the <code class="directive"><a href="./mod/mpm_common.html#listen">Listen</a></code> directive) to test for any incompatibilities before doing the final upgrade.</div></div></div><div class="bottomlang"><p><span>Available Languages: </span><a href="./de/install.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |<a href="./en/install.html" title="English"> en </a> |<a href="./es/install.html" hreflang="es" rel="alternate" title="Espa駉l"> es </a> |<a href="./fr/install.html" hreflang="fr" rel="alternate" title="Fran鏰is"> fr </a> |<a href="./ja/install.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |<a href="./ko/install.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |<a href="./tr/install.html" hreflang="tr" rel="alternate" title="T黵k鏴"> tr </a></p></div><div id="footer"><p class="apache">Copyright 2008 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p><p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/directives.html">Directives</a> | <a href="./faq/">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -