1
2
3
4
5
6
|
[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/
|
1
2
3
4
5
|
[root@localhost~]
# vi /etc/httpd/conf/httpd.conf
LoadModulejk_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
|
1
2
3
4
5
6
7
8
9
10
|
[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/profile
JAVA_HOME=
/usr/local/jdk1
.7
PATH=$PATH:$JAVA_HOME
/bin
CLASSPATH=.:$JAVA_HMOE
/lib
:$JAVA_HOME
/jre/lib
export
JAVA_HOMEPATH CLASSPATH
[root@localhost~]
# source /etc/profile
[root@localhost~]
# java -version
java version
"1.7.0_17"
|
1
2
3
4
|
[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 & #后台运行
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
[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
>
|
1
2
|
[root@localhostjboss7.1]
# killall java
[root@localhostjboss7.1]
# nohup bin/standalone.sh &
|
1
2
3
4
5
6
7
|
[root@localhost ~]
# vi /etc/httpd/conf/mod_jk.conf
JkWorkersFileconf
/workers
.properties
JkLogFile
/var/log/httpd/mod_jk
.log
JkShmFile
/var/log/httpd/mod_jk
.shm
JkLogLevel info
JkMount
/servilet/
* jboss
JkMount /*.jspjboss
#所有jsp文件由jboss处理
|
1
2
3
4
5
|
[root@localhost ~]
# vi /etc/httpd/conf/workers.properties
worker.list=jboss
worker.jboss.
type
=ajp13
#使用ajp协议1.3版本
worker.jboss.host=127.0.0.1
worker.jboss.port=8009
#连接jboss 8009端口
|
1
2
3
4
5
6
7
8
9
10
|
[root@localhostjboss7.1]
# vi standalone/configuration/standalone.xml
<
/subsystem
>
<subsystemxmlns=
"urn:jboss:domain:web:1.1"
default-virtual-server=
"default-host"
native=
"false"
>
<connector name=
"http"
protocol=
"HTTP/1.1"
scheme=
"http"
socket-binding=
"http"
/>
<connector name=
"ajp"
protocol=
"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
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
[root@localhost ~]
# vi /etc/httpd/conf/httpd.conf
Listen192.168.1.153:81
Listen192.168.1.153:82
<VirtualHost*:81>
# ServerAdminwebmaster@dummy-host.example.com
DocumentRoot
/usr/local/jboss7
.1
/standalone/deployments
ServerName 192.168.1.153
JkMount /* jboss
#这个目录下的所有程序都由定义的jboss处理
# ErrorLoglogs/dummy-host.example.com-error_log
# CustomLoglogs/dummy-host.example.com-access_log common
<
/VirtualHost
>
<VirtualHost*:82>
# ServerAdminwebmaster@dummy-host.example.com
DocumentRoot
/opt
ServerName 192.168.1.153
# ErrorLoglogs/dummy-host.example.com-error_log
# CustomLoglogs/dummy-host.example.com-access_log common
<
/VirtualHost
>
|
1
2
3
4
5
6
7
8
|
[root@localhostjboss7.1]
# cd standalone/deployments/
[root@localhostdeployments]
# ls
index.jsp README.txt
[root@localhost deployments]
#jar cvf test.war index.jsp #将index.jsp用jar工具归档后才可以自动部署
added manifest
adding:index.jsp(
in
= 10) (out= 12)(deflated -20%)
[root@localhostdeployments]
# ls
index.jsp README.txt
test
.war
test
.war.deployed
#部署成功后,会生成一个以deployed结果的文件
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
[root@localhost jboss7.1]
# vi standalone/configuration/standalone.xml
<
/subsystem
>
<subsystemxmlns=
"urn:jboss:domain:web:1.1"
default-virtual-server=
"default-host"
native=
"false"
>
<connector name=
"http"
protocol=
"HTTP/1.1"
scheme=
"http"
socket-binding=
"http"
/>
<connector name=
"ajp"
protocol=
"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
>
|
1
2
3
4
5
6
7
8
|
[root@localhostdeployments]
# ls
index.jsp WEB-INF
[root@localhostdeployments]
# vi WEB-INF/jboss-web.xml
<jboss-web>
<context-root>/<
/context-root
>
#从部署根目录访问
<virtual-host>192.168.1.153<
/virtual-host
>
#虚拟主机ip或域名
<
/jboss-web
>
[root@localhostdeployments]
# jar cvf root.war index.jsp WEB-INF/
|