Home > Article > Operation and Maintenance > Detailed explanation of Windows Apache2.4 VC9 (ApacheHaus) installation tutorial
This article mainly introduces the detailed installation and configuration tutorial of Windows Apache2.4 VC9 (ApacheHaus). Friends in need can refer to
1, Apache download
Select a version and click Download
##Click File For Microsoft Windows Since Apache HTTP Server is not officially A binary (executable) distribution is provided, so we choose the version compiled by some contributors. We choose the first ApacheHausClick ApacheHaus to enter the download page Choose one of the versions. If your Windows has not installed the corresponding VC environment, select the corresponding VCRedistribute version to download and install. I chose Apache 2.4VC9 version because the VC9 environment is already installed on my computer. Click on a version in the first line under JumpLinks to download the corresponding compressed package. 2, configure one of Apache--httpd.confAfter decompressing, enter the Apache22 (the last two digits may be different) folder, and use a text editor (ultraedit is recommended) to open the conf file Find the ServerRoot option in the httpd.conf configuration file in the folder , set the Apache directory, about line 35, change it to the folder of your Apache program, for example:ServerRoot "C:/Users/myPC/Downloads/httpd-2.2.31-x86-r3/Apache22"found Listen option, set the port, about 46 lines, generally do not modify, use the default 80, please ensure that port 80 is not occupied before starting the server Find the DocumentRoot option, modify the server root directory, for example:
DocumentRoot "F:/"Please ensure that this directory exists, otherwise the server cannot start normally Modify Directory to ensure that it is the same as the server root directory, only modify the quotation marks in the first line below
<Directory "F:/"> # # Possible values for the Options directive are "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 to 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 may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride None # # Controls who can get stuff from this server. # Order allow,deny Allow from all </Directory>Find ScriptAlias option, set the server script directory, about 326 lines, 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"Find the subsequent Directory option, set the script directory, about 342 lines, you need to set it It is 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 2--ssl configuration
If you start the service like this, the following message dialog will generally appear Box: PromptWindows cannot start Apache2.2 on the local computer. For more information, consult the system log files. If this is a non-Microsoft service, please contact the vendor and refer to the specific server error code 1. Determine the cause of this problem: Right-click the computer, click Manage->Windows Log->Applications, the following is displayed<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 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.0 CustomLog "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>Mainly change the four places aboveThere are two other VirtualHosts on lines 130 and 152, both of which need to modify the above four OptionExample:Line 130
<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.0 CustomLog "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" env=HTTPS </virtualhost>Line 152
<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.0 CustomLog "C:/Users/myPC/Downloads/httpd-2.2.31-x86-r3/Apache22/ssl_request.log" \ "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" </virtualhost>Both the above two VirtualHosts need to be modified in four placesLike this , even if Apache is configured, if there are still problems, you may need to configure ./conf/extra/httpd-ssl.conf. The configuration method is similar to configuring VirtualHost4, start Apache HTTP ServerUse the Windows command line
As an administratorEnter the bin folder under the Apache program folder and enter httpd -k install to complete the installation of the Apache service.
Then double-click ApacheMonitor.exe in the bin directory, click start on the right to start the server, if normal, as shown below: Test it:5, others
Uninstall Apache HTTP Server:
Enter the bin directory as an administrator and use httpd -k uninstall to remove the service
Using the httpd -w -n "Apache2" -k start command to start the server can display the logs during the startup process to facilitate error analysis.
The above is the detailed content of Detailed explanation of Windows Apache2.4 VC9 (ApacheHaus) installation tutorial. For more information, please follow other related articles on the PHP Chinese website!