1\安裝JDK軟件, 2\安裝Tomcat 3、解壓Tomcat軟件包,然后將整個軟件包移動到/usr/local/ 下載地址 4\整合apache和tomcat (先安裝apache,使用--enable-module=s0) /usr/local/apache2
在/usr/local/apache2/conf/下面建立兩個配置文件mod_jk.conf和workers.properties。 # vi mod_jk.conf 添加以下內(nèi)容: # 指出mod_jk模塊工作所需要的工作文件workers.properties的位置 JkWorkersFile /usr/local/apache2/conf/workers.properties # Where to put jk logs JkLogFile /usr/local/apache2/logs/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel info: JkLogStampFormat "[%a %b %d %H:%M:%S %Y]" # JkOptions indicate to send SSL KEY SIZE, # JkRequestLogFormat set the request format JkRequestLogFormat "%w %V %T" # 將所有servlet 和jsp請求通過ajp13的協(xié)議送給Tomcat,讓Tomcat來處理 JkMount /servlet/* worker1 JkMount /*.jsp worker1
添加以下內(nèi)容: # 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.cachesize=10 worker.worker1.cache_timeout=600 worker.worker1.socket_keepalive=1 worker.worker1.socket_timeout=300 再配置httpd.conf,作以下修改: 將Listen 80 修改為 Listen 127.0.0.1:80 將ServerName 修改為 ServerName LocalHost:80 在DirectoryIndex中添加 index.jsp
最后編輯Tomcat的配置文件server.xml,在HOST段中加入: <Context path="" docBase="/usr/local/apache2/htdocs" debug="0" reloadable="true" crossContext="true"/> 在/var/wwwroot下建立一個index.jsp: 2 + 2 = 啟動Apache和Tomcat,用瀏覽器訪問http://localhost/,應(yīng)該可以看到正確的頁面了 |
|