/opt/httpd-2.4.38 --httpd軟件目錄
/opt/apache-tomcat-8.5.38 --tomcat軟件目錄
/opt/java/jdk1.8.0_201-amd64 --jdk目錄
編譯 httpd2.4.38參數
yum -y -q install apr-devel apr-util-devel openssl-devel pcre-devel mod_ssl expat-devel
./configure --prefix=/opt/httpd-2.4.38 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --enable-modules=most --enable-mpms-shared=all --with-mpm=worker
httpd-devel
刪除舊版java
rpm -qa | grep java
rpm -e nodeps xxxxx
修改java環境變量
export JAVA_HOME=/opt/java/jdk1.8.0_201-amd64/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar?
export PATH=$PATH:$JAVA_HOME/bin
httpd-devel
編譯mod_jk.so參數
./configure --with-apxs=/opt/httpd-2.4.38/bin/apxs
httpd.conf修改內容
/var/webapps爲網站目錄
DocumentRoot "/var/webapps"
<Directory "/var/webapps">
#
# 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.4/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:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
LoadModule jk_module /opt/httpd-2.4.38/modules/mod_jk.so
Include /opt/httpd-2.4.38/conf/mod_jk.conf
mod_jk.conf配置內容
JkWorkersFile /opt/httpd-2.4.38/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 tosend SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat setthe request format
JkRequestLogFormat "%w %V %T"
# 將所有servlet 和jsp請求通過ajp13的協議送給Tomcat,讓Tomcat來處理
JkMount /*.jsp worker1
JkMount /a/*.jsp worker1
workers.properties內容
# Defining a workernamed worker1 and of type ajp13
worker.list=worker1
# Set properties forworker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=300
server.xml配置修改內容
<Host name="localhost" appBase="/var/webapps"