1,apache Download
Select a version and click Download
Click File for Microsoft Windows
Since Apache HTTP Server officially does not provide a binary (executable) release, so we select some contributors to compile the completed version, we select the first Apachehaus
Click Apachehaus to go to the download page
Select one of the versions and if your Windows has not installed the corresponding VC environment, select the corresponding Vcredistribute version to download the installation. I chose Apache version 2.4vc9 because I already have a VC9 environment installed on my computer.
Click on a version of the first line under Jumplinks to download the corresponding compression package.
2, configure one of Apache--httpd.conf
Unzip into the inside Apache22 (the last two digits may be different) folder, use a text editor (recommended UltraEdit) to open the Httpd.conf profile in the Conf folder
Locate the ServerRoot option, set the Apache directory, about 35 rows, and change it to the folder of your Apache program, for example:
ServerRoot "C:/users/mypc/downloads/httpd-2.2.31-x86-r3/apache22"
Find the Listen option, set the port, about 46 lines, generally do not modify, using the default 80, before you turn on the server, ensure that 80 ports are not occupied
To locate the DocumentRoot option, modify the server root directory, for example:
DocumentRoot "f:/"
Please ensure that this directory exists or the server will not start properly
Modify the directory to make sure it is the same as the server root, modifying only the quotation marks section of the first line below
<directory "f:/" > # # Possible values for the Options directive is ' None ', ' All ', # or any combination of: # Indexes includes followsymlinks symlinksifownermatch execcgi multiviews # # Note that " MultiViews "must be named *explicitly*---" Options all " # doesn ' t give it for you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # Options Indexes followsymlinks # # allowoverride Controls What directives is placed in. htaccess file S. # It can be ' all ', ' None ', or any combination of the keywords: # Options FileInfo authconfig Limit # A Llowoverride None # # Controls who can get stuff from the this server. # Order allow,deny allow from all</directory>
Locate the Scriptalias option, set the server script directory, approximately 326 lines, and generally set it to the Cgi-bin folder under the Apache directory
scriptalias/cgi-bin/"C:/users/mypc/downloads/httpd-2.2.31-x86-r3/apache22/cgi-bin"
Locate the following directory options, set the script directory, approximately 342 lines, and set it to be the same as the previous Scriptalias directory
<directory "C:/users/mypc/downloads/httpd-2.2.31-x86-r3/apache22/cgi-bin" > allowoverride None Options None Order allow,deny allow from all</directory>
3, configure Apache II--ssl configuration
If you enable the service to start, the following message dialog box typically appears:
Tips
Windows cannot start Apache2.2 on the local computer. For more information, consult the system log file. If this is a non-Microsoft service, contact the vendor and refer to the specific server error code 1.
Determine the cause of this problem:
Right-click on the computer , tap Manage->windows log application, display the following
This is due to the incorrect SSL configuration, and the following is a workaround.
Open the Apache program directory under the conf/extra/httpd-ahssl.conf file, configure the VirtualHost option, there are three options named VirtualHost, you need to modify.
The first one is about 107 rows.
In about 110 rows, change the sslcertificatefile to: Apache directory/CONF/SSL/SERVER.CRT
In about 111 rows, change Sslcertificatekeyfile to: Apache directory/conf/ssl/server.key
Change DocumentRoot to your server root in about 112 rows
In 126 rows or so, the Customlog will be changed to: Apache directory/logs/ssl_request.log, this will not change the words can be wrong. The following error is generally present:
The Apache2.2 service terminated because of the following service-specific error: the function is incorrect.
Changes to the effect:
<virtualhost _default_:443> sslengine on ServerName localhost:443 sslcertificatefile c:/users/ MYPC/DOWNLOADS/HTTPD-2.2.31-X86-R3/APACHE22/CONF/SSL/SERVER.CRT Sslcertificatekeyfile C:/Users/myPC/ Downloads/httpd-2.2.31-x86-r3/apache22/conf/ssl/server.key documentroot f:/# OpenSSL req-new > server.csr# OpenSSL rsa-in privkey.pem-out server.key# OpenSSL x509-in server.csr-out server.crt-req-signkey server.key-days 20 48<filesmatch "\. (cgi|shtml|phtml|php) $ "> ssloptions +stdenvvars</filesmatch><directory"/apache22/cgi-bin "> ssloptions +stdenvvars</directory>browsermatch "MSIE [2-5]" nokeepalive ssl-unclean-shutdown downgrade-1.0 Force-response-1.0customlog "C:/users/mypc/downloads/httpd-2.2.31-x86-r3/apache22/logs/ssl_ Request.log " "%t%h%{ssl_protocol}x%{ssl_cipher}x \ "%r\"%b "</virtualhost>
Major changes to the area above
There are two additional virtualhost in rows 130 and 152, and you need to modify the four options above
Cases:
130 rows
<virtualhost *:443> sslengine on ServerName serverone.tld:443 sslcertificatefile c:/users/mypc/ DOWNLOADS/HTTPD-2.2.31-X86-R3/APACHE22/CONF/SSL/SERVERONE.CRT Sslcertificatekeyfile C:/Users/myPC/Downloads /httpd-2.2.31-x86-r3/apache22/conf/ssl/serverone.key documentroot f:/# OpenSSL req-new > serverone.csr# OpenSSL rsa-in privkey.pem-out serverone.key# OpenSSL x509-in serverone.csr-out serverone.crt-req-signkey serverone. Key-days 2048<filesmatch "\. (cgi|shtml|phtml|php) $ "> ssloptions +stdenvvars</filesmatch><directory"/apache22/cgi-bin "> ssloptions +stdenvvars</directory>browsermatch "MSIE [2-5]" nokeepalive ssl-unclean-shutdown downgrade-1.0 Force-response-1.0customlog "C:/users/mypc/downloads/httpd-2.2.31-x86-r3/apache22/logs/ssl_ Request.log "
Line 152th
<virtualhost *:443> sslengine on ServerName servertwo.tld:443 sslcertificatefile c:/users/mypc/ DOWNLOADS/HTTPD-2.2.31-X86-R3/APACHE22/CONF/SSL/SERVERTWO.CRT Sslcertificatekeyfile C:/Users/myPC/Downloads /httpd-2.2.31-x86-r3/apache22/conf/ssl/servertwo.key documentroot f:/# OpenSSL req-new > servertwo.csr# OpenSSL rsa-in privkey.pem-out servertwo.key# OpenSSL x509-in servertwo.csr-out servertwo.crt-req-signkey servertwo. Key-days 2048<filesmatch "\. (cgi|shtml|phtml|php) $ "> ssloptions +stdenvvars</filesmatch><directory"/apache22/cgi-bin "> ssloptions +stdenvvars</directory>browsermatch "MSIE [2-5]" nokeepalive ssl-unclean-shutdown downgrade-1.0 Force-response-1.0customlog "C:/users/mypc/downloads/httpd-2.2.31-x86-r3/apache22/ssl_request.log"
All of the above two virtualhost need to be modified around
In this way, Apache even if the configuration is finished, if there are problems, you may need to configure./conf/extra/httpd-ssl.conf, configuration method and configuration VirtualHost similar
4. Start Apache HTTP Server
Use the Windows command line as an administrator to enter the Bin folder under the Apache Program's folder, enter Httpd-k install, and complete the Apache service installation.
Then double-click on the ApacheMonitor.exe in the Bin directory and click on the start server on the right, if normal, such as:
Test it:
5, other
Uninstalling Apache HTTP Server:
The administrator enters the bin directory and uses httpd-k Uninstall to remove the service
Starting the server with the Httpd-w-n "Apache2"-K Start command displays logs during startup to facilitate parsing errors.
Apache (Apachehaus) Installation configuration tutorial