Reprint: http://blog.csdn.net/wqmain/article/details/8941759
If you can open this article, stating that you are familiar with the Apache HTTP Server (hereinafter referred to as the Apache abbreviation) The importance of configuration is very clear, this article does not repeat, directly involved in the topic, please read down:
For readability, list the article directory:
First, Apache installation instructions
Second, the basic configuration of Apache
Third, Apache integrated TOMCAT configuration
The following is the body content:
First, Apache installation instructions
1, first open the Apache official website, enter the Windows version of the page: http://archive.apache.org/dist/httpd/binaries/win32/and select 2.2.22_no_ The SSL version of the MSI installation package is downloaded (the high version is not yet available at the time of writing the MSI installation package),
The download is ready to start the installation.
2. Run the MSI file (Httpd-2.2.22-win32-x86-no_ssl.msi) that you just downloaded, and the installation process is as follows:
Click Next to continue:
The above network domain, Server name and email address three items if the computer is used to test the individual feel that there is no problem, but if it is the real network environment domain names and other parameters are unique, should be filled out truthfully, click Next to continue:
Select Custom here, you can customize the installation path, etc., click Next to continue:
The contents of the red box are the Apache installation path, you can click Change, other information by default, click Next to continue:
Click Install to start the installation:
The installation process will pop up a few cmd windows, will automatically close, no tube, and finally:
Click Finish to install, start the operation of the input services.msc, you can see that Apache has been registered as a Windows service:
Apache Monitor is also automatically turned on in the lower-right corner of the Windows taskbar: If the Apache service does not start automatically or when the Apache service is launched, a similar window appears:
Indicates that the Apache default port 80 is already occupied. You can turn off the software that uses 80 ports, or you can change the Apache default configuration to listen to other ports.
Second, the basic configuration of Apache
Open the Apache installation directory, whose main configuration is in the httpd.conf file under the Conf folder, in the location:
Open the httpd.conf file with UltraEdit or notepad++, and read from the top down:
1, the 35th line, ServerRoot for the Apache installation path, this understanding can, do not control it;
2, line 46th, Listen 80 Specifies 80 is the default listening port of Apache, here we change to 88, to prevent and other 80 port-occupied software conflicts. When you're done, start it in the Windows service, and you'll see there's no error window. Open the browser, enter http://localhost:88 in the address bar if you see the following message stating that Apache has been installed properly and started successfully:
3, the 172th line, ServerName for the previous installation of the DNS domain name (if there is no domain name on the input IP, remember with the upper slogan), #号为注释, here to remove the # #, modified content as follows:
ServerName 127.0.0.1:88
After the modification, first test the configuration is correct: Open Start menu-"All Programs, find Apache HTTP Server 2.2 Under the test configuration, and run,
If the content of the CMD serial port is Syntax OK and flash over, the configuration is not a problem, otherwise it will prompt the error message and stay 30 after the automatic shutdown.
4, the 179th line, DocumentRoot General for JS, CSS, HTML, PNG, GIF, JPG and other static resource file storage directory, where we define the Apache_statics folder in the D disk. The revised content is as follows:
DocumentRoot "D:/apache_statics"
5. Line 193th, change the Deny from all to allow from all otherwise access the static file when the page prompts Forbidden to prohibit access to the information. The modified content such as:
6, the No. 206 line, Directory modified to and documentroot corresponding value of the same, modified content as follows:
<directory "D:/apache_statics" >
7, the No. 219 line, the options Indexes followsymlinks comment out, and the next to add a line options None. The role and the listings in Conf/web.xml under Tomcat are set to false, in order to avoid listing the directory structure of the server-side resources in the browser.
Third, Apache integrated TOMCAT configuration
Apache can integrate different modules to complete the default features that are not provided, such as the integration of TOMCAT requires the installation of MOD_JK this module. By loading this module and configuring it, Apache can parse the static resource content by listening to the specified port (88 port configured above), and dynamic resource content such as JSP, servlet, action is given to Tomcat to parse. Specify the following:
1, first go to the official website Download MOD_JK module, address: http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.31/ Select the latest version of the mod_jk-1.2.31-httpd-2.2.3.so download;
2. Copy the mod_jk-1.2.31-httpd-2.2.3.so file to the Modules folder of the Apache installation directory, such as:
3. Create a new Workers.properties file in the Conf folder (the folder where httpd.conf is located), as follows:
Workers.tomcat_home is the installation path for Tomcat, Workers.java_home is the installation path for the JDK, MOD_JK generally uses the AJP13 protocol to connect with Tomcat, using port 8009 by default, the port can be used in Tomcat's Conf/server.xml in the view, such as:
4. Add a piece of code at the very end of the httpd.conf, such as (inside the red box):
The code above loads the MOD_JK module and the Workers.properties file and defines the output location of the log file (Logs/mod_jk.log); ServerAdmin, DocumentRoot, ServerName is the same as the previous configuration, jkmount specifies that those paths will be given to Tomcat through the AJP13 protocol, multiple paths define multiple Jkmount ... ajp13. The URLs that start with web-inf or end with. Action or. jsp, or start with servlet/, are referred to Tomcat for parsing. Since then, Apache and Tomcat have been integrated, often with the static resource portion of the program deployed under the previously mentioned D:\Apache_Statis folder, rather than the static resource deployed under Tomcat.
Write here first, followed by another blog post on the Apache protection against DDoS (denial of service attack) configuration and URL rewriting examples.
Windows Apache HTTP Server installation, configuration, and integration with Tomcat (drawings)