linux系統(tǒng)apache tomcat虛擬主機安裝配置是怎樣的,很多新手對此不是很清楚,為了幫助大家解決這個難題,下面小編將為大家詳細講解,有這方面需求的人可以來學習下,希望你能有所收獲。
專注于為中小企業(yè)提供成都網(wǎng)站建設(shè)、成都做網(wǎng)站服務,電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業(yè)個舊免費做網(wǎng)站提供優(yōu)質(zhì)的服務。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了成百上千企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實現(xiàn)規(guī)模擴充和轉(zhuǎn)變。
多年不用tomcat,應一朋友要求,搭建一個java環(huán)境的虛擬主機,經(jīng)過多次測試,現(xiàn)在把可以正常運行的配置記錄下來。
安裝jdk
cd /usr/local
sh /mnt/MySQL/jdk-6u14-linux-i586.bin
ln -s jdk1.6.0_14/ jdk
echo "export JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib" >> /etc/profile.d/java.sh
chmod +x /etc/profile.d/java.sh
安裝tomcat
wget http://apache.freelamp.com/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.tar.gz
tar xzf apache-tomcat-6.0.20.tar.gz -C /usr/local/
cd /usr/local/
ln -s apache-tomcat-6.0.20/ tomcat
vi ~/.bash_profile
TOMCAT_HOME=/usr/local/tomcat
export PATH TOMCAT_HOME
source ~/.bash_profile
安裝jk connector
wget http://labs.xiaonei.com/apache-mirror/tomcat/tomcat-connectors/jk/source/jk-1.2.28/tomcat-connectors-1.2.28-src.tar.gz
tar xfz tomcat-connectors-1.2.28-src.tar.gz -C /usr/local/src/
cd /usr/local/src/tomcat-connectors-1.2.28-src/
cd native/
./configure –with-apxs=/usr/local/httpd/bin/apxs
make
cp apache-2.0/mod_jk.so /usr/local/httpd/modules/
apche配置
vim /usr/local/httpd/conf/extra/httpd-vhosts.conf
LoadModule jk_module modules/mod_jk.so
Include /usr/local/httpd/conf/mod_jk.conf
JkMountCopy On
ServerName edu.veryi.com
DirectoryIndex index.jsp index.html index.jsp index.htm
DocumentRoot /usr/local/tomcat/webapps/ROOT
#DocumentRoot /usr/local/www/edu.veryi.com/html
#
Order allow,deny
Allow from all
CustomLog "|/usr/local/sbin/cronolog /var/log/httpd/edu.veryi.com-access_log.%Y%m%d" combined
ErrorDocument 404 /missing.html
vim /usr/local/httpd/conf/mod_jk.conf
JkWorkersFile /usr/local/httpd/conf/workers.properties
# Where to put jk logs
JkLogFile /usr/local/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"
# servlet 和jsp請求通過ajp13的協(xié)議送給Tomcat
JkMount /servlet/* worker1
JkMount /*.jsp worker1
——————————
/usr/local/httpd/conf/workers.properties
# Defining a worker named worker1 and of type ajp13
worker.list=worker1
# Set properties for worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
#worker.worker1.lbfactor=50
#worker.worker1.socket_keepalive=1
#worker.worker1.socket_timeout=300
tomcat配置
vim /usr/local/tomcat/conf/server.xml
unpackWARs="true" autoDeploy="true"> prefix="tomcat_access_log." suffix=".log" pattern="common" resolveHosts="false"/> prefix="tomcat_file_log." suffix=".log" timestamp="true"/>
看完上述內(nèi)容是否對您有幫助呢?如果還想對相關(guān)知識有進一步的了解或閱讀更多相關(guān)文章,請關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝您對創(chuàng)新互聯(lián)的支持。