在這裏我所用的配置以下:html
整合前所須要作的準備工做包括:java
上述的安裝配置過程再也不贅述,下面從安裝Tomcat connectors開始:apache
[root@271d5811ce45 local]# tar -zxvf tomcat-connectors-1.2.43-src.tar.gz
[root@271d5811ce45 local]# cd tomcat-connectors-1.2.43-src/native/
[root@271d5811ce45 native]# ./configure --with-apxs=/usr/local/apache2/bin/apxs [root@271d5811ce45 native]# make [root@271d5811ce45 native]# make install
[root@271d5811ce45 apache-2.0]# cp mod_jk.so /etc/httpd/modules/
mod_jk.conf:tomcat
#LoadModule jk_module modules/mod_jk.so JkWorkersFile /etc/httpd/conf/workers.properties # Where to put jk logs JkLogFile /etc/httpd/logs/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel info # Select the log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y]" # JkOptions indicate to send SSL KEY SIZE, JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories # JkRequestLogFormat set the request format JkRequestLogFormat "%w %V %T" JkMount /*WEB-INF worker1 JkMount /*.action worker1 JkMount /*.jsp worker1 JkMount /application/* worker1 JkMount /*.do worker1 JkMount /*.class worker1 JkMount /*/servlet/* worker1
workers.properities:app
# Defining a worker named worker1 and of type ajp13 worker.list=worker1 # Set properties for worker1 worker.worker1.port=8009 worker.worker1.host=localhost worker.worker1.type=ajp13 worker.worker1.lbfactor=50 worker.worker1.cachesize=10 worker.worker1.cache_timeout=600 worker.worker1.socket_keepalive=1 worker.worker1.socket_timeout=300
而後在Apache的配置文件中導入這兩個模塊,在httpd.conf文件的末尾加入如下內容:socket
LoadModule jk_module modules/mod_jk.so
Include /etc/httpd/conf/mod_jk.conf
[root@271d5811ce45 conf]# systemctl restart httpd
<html> <head><title>Hello</title></head> <body> <% java.util.Date currentTime = new java.util.Date(); %> <%=currentTime%> </body> </html>
訪問該jsp頁面:jsp
該路徑下的靜態頁面:測試
至此動態和靜態頁面成功實現分離。spa