企业Java应用服务器之JBoss7.1与Apahce整合

[root@localhost~]# tar zxvf tomcat-connectors-1.2.39-src.tar.gz[root@localhost~]# cd tomcat-connectors-1.2.39-src[root@localhosttomcat-connectors-1.2.39-src]# cd native/[root@localhostnative]# ./configure –with-apxs=/usr/sbin/apxs –with-java-home=/usr/local/jdk1.7/[root@localhostnative]# make[root@localhostnative]# cp apache-2.0/mod_jk.so /etc/httpd/modules/[root@localhost~]# vi /etc/httpd/conf/httpd.confLoadModulejk_module modules/mod_jk.so #加载jk模块Include/etc/httpd/conf/mod_jk.conf#先加载jk配置文件DirectoryIndex index.phpindex.jsp index.html index.html.var #添加索引页[root@localhost~]# service httpd restart

二、安装JDK1.7

[root@localhost~]# tar zxvf jdk-7u17-linux-x64.tar.gz[root@localhost~]# mv jdk1.7.0_17/ /usr/local/jdk1.7[root@localhost~]# vi /etc/profileJAVA_HOME=/usr/local/jdk1.7PATH=$PATH:$JAVA_HOME/binCLASSPATH=.:$JAVA_HMOE/lib:$JAVA_HOME/jre/libexport JAVA_HOMEPATH CLASSPATH[root@localhost~]# source /etc/profile[root@localhost~]# java -versionjava version”1.7.0_17″

三、安装Jboss7.1

[root@localhost~]# tar zxvf jboss-as-7.1.1.Final.tar.gz[root@localhost~]# mv jboss-as-7.1.1.Final /usr/local/jboss7.1[root@localhost~]# cd /usr/local/jboss7.1/[root@localhostjboss7.1]# nohup bin/standalone.sh & #后台运行

[root@localhostjboss7.1]# vi standalone/configuration/standalone.xml<interfaces><interfacename=”management”><inet-addressvalue=”${jboss.bind.address.management:192.168.1.153}”/>#web后台管理IP,默认端口是9990</interface><interfacename=”public”><inet-addressvalue=”${jboss.bind.address:0.0.0.0}”/>#jboss监听ip地址,,0.0.0.0为所有</interface><!– TODO – only show this if thejacorb subsystem is added –><interfacename=”unsecure”><!–~ Used for IIOP sockets in the standard configuration.~To secure JacORB you need tosetup SSL–><inet-addressvalue=”${jboss.bind.address.unsecure:127.0.0.1}”/></interface></interfaces>

重启JBoss

[root@localhostjboss7.1]# killall java[root@localhostjboss7.1]# nohup bin/standalone.sh &

[root@localhost ~]# vi /etc/httpd/conf/mod_jk.confJkWorkersFileconf/workers.propertiesJkLogFile/var/log/httpd/mod_jk.logJkShmFile/var/log/httpd/mod_jk.shmJkLogLevel infoJkMount/servilet/* jbossJkMount /*.jspjboss#所有jsp文件由jboss处理

[root@localhost ~]# vi /etc/httpd/conf/workers.propertiesworker.list=jbossworker.jboss.type=ajp13 #使用ajp协议1.3版本worker.jboss.host=127.0.0.1worker.jboss.port=8009 #连接jboss 8009端口

2. 添加AJP/1.3协议支持

[root@localhostjboss7.1]# vi standalone/configuration/standalone.xml</subsystem><subsystemxmlns=”urn:jboss:domain:web:1.1″default-virtual-server=”default-host” native=”false”><connectorprotocol=”HTTP/1.1″ scheme=”http”socket-binding=”http”/><connectorprotocol=”AJP/1.3″ scheme=”http” socket-binding=”ajp”/> #添加ajp支持<virtual-servername=”default-host” enable-welcome-root=”true”><aliasname=”localhost”/><aliasname=”example.com”/></virtual-server></subsystem>

3.创建虚拟主机测试

[root@localhost ~]# vi /etc/httpd/conf/httpd.confListen192.168.1.153:81Listen192.168.1.153:82<VirtualHost*:81># ServerAdminwebmaster@dummy-host.example.comDocumentRoot/usr/local/jboss7.1/standalone/deploymentsServerName 192.168.1.153JkMount /* jboss #这个目录下的所有程序都由定义的jboss处理# ErrorLoglogs/dummy-host.example.com-error_log# CustomLoglogs/dummy-host.example.com-access_log common</VirtualHost><VirtualHost*:82># ServerAdminwebmaster@dummy-host.example.comDocumentRoot /optServerName 192.168.1.153# ErrorLoglogs/dummy-host.example.com-error_log# CustomLoglogs/dummy-host.example.com-access_log common</VirtualHost>

[root@localhostjboss7.1]# cd standalone/deployments/[root@localhostdeployments]# lsindex.jsp README.txt[root@localhost deployments]#jar cvf test.war index.jsp #将index.jsp用jar工具归档后才可以自动部署added manifestadding:index.jsp(in = 10) (out= 12)(deflated -20%)[root@localhostdeployments]# lsindex.jsp README.txt test.war test.war.deployed #部署成功后,会生成一个以deployed结果的文件

1.在配置文件添加

[root@localhost jboss7.1]# vi standalone/configuration/standalone.xml </subsystem><subsystemxmlns=”urn:jboss:domain:web:1.1″default-virtual-server=”default-host” native=”false”><connectorprotocol=”HTTP/1.1″ scheme=”http”socket-binding=”http”/><connectorprotocol=”AJP/1.3″ scheme=”http”socket-binding=”ajp”/><virtual-servername=”default-host” enable-welcome-root=”false”><aliasname=”localhost”/><aliasname=”example.com”/></virtual-server>下面添加,name是域名,我以ip代替:<virtual-servername=”192.168.1.153″ enable-welcome-root=”false”><aliasname=”192.168.1.153″/></virtual-server></subsystem>要知道,当你一直在担心错过了什么的时候,

企业Java应用服务器之JBoss7.1与Apahce整合

相关文章:

你感兴趣的文章:

标签云: