How to Configure Apache Web Server With Tomcat in Windows
Install Apache HTTP Server
-
Download the Windows binary distribution (.msi file) from
http://archive.apache.org/dist/httpd/binaries/win32/. -
Run the MSI file that you downloaded.
-
By default, the Apache HTTP Server is installed on port 80. If some other server is using port 80, you must change the port on which Apache listens for requests in the
<apache-httpd- install>\conf\httpd.conffile. Search for the directiveListenin the configuration file and change the port number by changing this directive to<new-port-num>. -
Ensure that the Apache HTTP server is working correctly. To do so, enter the URL for the Apache server (
http://<hostname>:<port-number>) in a Web browser. The server should display a page in the browser that says, "It Works!".
Download sample workers.properties
Download sample workers.properties from this page, place it in the <apache-httpd -install>\conf folder. Now, modify the following variables:
-
workers.tomcat_home: Set to the Tomcat installation directory. -
workers.java_home: Set to the JDK path.
Download the mod_jk module
-
Download thie mod_jk module for Apache from
. This module exists ashttps://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.23/mod_jk-apache-2.2.4.so. -
Place the module in the
<apache-httpd-install>\modules\folder.
Modify the <apache httpd install>\conf\httpd.conf file
-
Add the
mod_jkmodule by appending the following line of text to the<apache-httpd -install>\conf\httpd.conffile:LoadModule jk_module modules/mod_jk-apache-2.2.4.so -
Using the
JkMountcommand, add the context names that you want to direct to Tomcat:JkMount /robohelp/* ajp13 JkMount /th robohelp ajp13
Enable Apache auto-configure
-
In the
server.xmlfor Tomcat (<tomcat-install-folder>\conf\server.xml), enable Apache auto-configure. Tomcat automatically generates the files required for usingmod_jkwith an Apache HTTPS Web server.<Engine> ...... <Host> ................ </Host> <Listener className="org.apache.jk.config.ApacheConfig" modJk=<apache-install-folder>\modules\<mod_jk_module> workersConfig=<apache install folder>\conf\workers.properties /> </Engine>modJKandworkersConfigmust have appropriate values. For example:<Listener className="org.apache.jk.config.ApacheConfig" modJk="C:\Program Files\Apache Software Foundation\Apache2.2\modules\mod_jk-apache-2.2.4.so" workersConfig="C:\Program Files\Apache Software Foundation\Apache2.2\conf\workers.properties" /> -
Stop the Apache HTTP Web server if it is running.
-
Restart Tomcat. The
<tomcat-install-folder>\conf\auto\mod_jk.conffile is generated. This file decides which URLs Apache passes to Tomcat.
Note: In mod_jk.conf, Tomcat creates a <VirtualHost> XML tag whose argument is the name of the <Host> tag just before the <Listener> (for modJK) tag in server.xml of Tomcat. Change the value of the name attribute of the <Host> tag to the server name.
Include the auto-generated file in Apache's httpd.conf file
Add"Include <tomcat-install-folder>\conf\auto\mod_jk.conf" at the start of the httpd.conf file.
Restart the Apache HTTP server
If the Apache HTTP server service does not start due to some error, do the following:
-
Run the command prompt.
-
Go to
<apache-install-folder>\bin. -
Run
httpd.exeto check for errors.
Enable UTF-8 encoded URLs
Modify <tomcat-install-folder>\conf\server.xml and enable UTF-8 encoded URLs in all connector tags:
.............. <Connector port="9090" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" /> ............ <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8" /> ............ Set up Tomcat for HTTPS
-
At the command prompt, change to the [JAVA_HOME]\bin directory.
Note: The JAVA_HOME environment variable usually points to the Java installation directory.
-
Run the following command:
keytool -genkeypair -alias tomcat -keyalg RSA -keystore key1 -validity 30A new keystore file is created in the home directory of the user who runs the command. To specify a different location or file name, modify the command to add the
-keystoreparameter followed by the complete path of the keystore file. You will also need to specify this new path in theserver.xmlconfiguration file, as described in Step 6. -
Enter the keystore password.
-
Enter the appropriate values when prompted for your personal and organization information.
-
When prompted, enter the Tomcat key password.
-
Modify the
server.xmlfile for your Tomcat server and add the following text, replacing the bold text with appropriate values for your system:<Connector port= [port number] protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" strategy="ms" address="${jboss.bind.address}" keystoreFile="${jboss.server.home.dir}/conf/THE_KEYSTORE_NAME" keystorePass="PASSWORD_FOR_THE_KEYSTORE" truststoreFile="${jboss.server.home.dir}/conf/THE_KEYSTORE_NAME" truststorePass="PASSWORD_FOR_THE_KEYSTORE" sslProtocol="TLS"/> -
Restart Tomcat.
How to Configure Apache Web Server With Tomcat in Windows
Source: https://help.adobe.com/en_US/robohelp-server/using/book/WS5E9F5C94-E737-4da1-872E-D490DAD694EF_ver2015.html
0 Response to "How to Configure Apache Web Server With Tomcat in Windows"
Post a Comment