环境:centos6.5+apache+tomcat+mysql
1、安装mysql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
yum
install
-y autoconf automake imake libxml2-devel expat-devel cmake gcc gcc-c++ libaio libaio-devel bzr bison libtool ncurses5-devel
useradd
-r mysql
tar
zxf mysql-5.6.26-linux-glibc2.5-x86_64.
tar
.gz -C
/usr/local/
cd
/usr/local/
ln
-s mysql-5.6.26-linux-glibc2.5-x86_64/ mysql
mkdir
/mysqldata
chown
-R mysql.mysql
/mysqldata/
cd
mysql
chown
-R root.mysql ./*
scripts
/mysql_install_db
--user=mysql --datadir=
/mysqldata/
cp
support-files
/mysql
.server
/etc/init
.d
/mysqld
chkconfig --add mysqld
chkconfig mysqld on
vim
/etc/profile
.d
/mysql
.sh
export
PATH=$PATH:
/usr/local/mysql/bin
.
/etc/profile
.d
/mysql
.sh
vim my.cnf
datadir =
/mysqldata
socket =
/tmp/mysql
.sock
service mysqld start
mysql_secure_installation
mysql -u root -p
mysql>create database jtbc character
set
utf8;
mysql>grant all privileges on *.* to root@
"192.168.100.%"
identified by
'centos'
;
mysql>flush privileges;
mysql -u root -p jtbc<_MYSQL.sql
|
2、安装tomcat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
yum
install
-y java-1.7.0-openjdk
tar
zxf apache-tomcat-7.0.65.
tar
.gz -C
/usr/local/
cd
/usr/local/
ln
-s apache-tomcat-7.0.65/ tomcat
vim
/etc/profile
.d
/tomcat
.sh
export
CATALINA_HOME=
/usr/local/tomcat
export
PATH=$PATH:$CATALINA_HOME
/bin
.
/etc/profile
.d
/tomcat
.sh
vim
/etc/init
.d
/tomcat
#!/bin/sh
# Tomcat init script for Linux.
#
# chkconfig: 2345 96 14
# description: The Apache Tomcat servlet/JSP container.
JAVA_OPTS=
'-Xms64m -Xmx128m'
JAVA_HOME=
/usr
CATALINA_HOME=
/usr/local/tomcat
export
JAVA_HOME CATALINA_HOME
exec
$CATALINA_HOME
/bin/catalina
.sh $*
chmod
+x
/etc/init
.d
/tomcat
chkconfig --add tomcat
chkconfig tomcat on
service tomcat start
|
3、安装apache
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
yum -y
install
gcc gcc-c++ openssl-devel pcre-devel
tar
xf apr-1.4.6.
tar
.bz2
cd
apr-1.4.6
.
/configure
--prefix=
/usr/local/apr
--disable-ipv6
make
&&
make
install
tar
xf apr-util-1.4.1.
tar
.bz2
cd
apr-util-1.4.1
.
/configure
--prefix=
/usr/local/apr-util
--with-apr=
/usr/local/apr
make
&&
make
install
tar
zxf httpd-2.4.17.
tar
.gz
cd
httpd-2.4.17
.
/configure
\
--prefix=
/usr/local/apache
\
--sysconfdir=
/etc/httpd
\
--
enable
-so \
--
enable
-ssl \
--
enable
-cgi \
--
enable
-rewrite \
--with-zlib \
--with-pcre \
--with-apr=
/usr/local/apr
\
--with-apr-util=
/usr/local/apr-util
\
--
enable
-modules=most \
--
enable
-mods-shared=most \
--
enable
-mpms-shared=all \
--with-mpm=event
make
&&
make
install
cp
build
/rpm/httpd
.init
/etc/init
.d
/httpd
vim
/etc/init
.d
/httpd
httpd=${HTTPD-
/usr/local/apache/bin/httpd
}
pidfile=${PIDFILE-
/usr/local/apache/logs/
${prog}.pid}
lockfile=${LOCKFILE-
/var/lock/subsys/
${prog}}
RETVAL=0
# check for 1.3 configuration
check13 () {
CONFFILE=
/etc/httpd/httpd
.conf
echo
"PATH=/usr/local/apache/bin:$PATH"
>>
/etc/profile
.d
/http
.sh
.
/etc/profile
.d
/http
.sh
ln
-s
/usr/local/apache/include/
/usr/include/httpd
vim
/etc/httpd/httpd
.conf
ServerName localhost:80
chkconfig --add httpd
chkconfig httpd on
service httpd start
|
4、配置Apache基于mod_proxy模块实现代理
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#配置tomcat主机
vim
/usr/local/tomcat/conf/server
.xml
<Engine name=
"Catalina"
defaultHost=
"www.jtbc.com"
jvmRoute=
"tomcata"
>
unpackWARs=
"true"
autoDeploy=
"true"
>
<!-- SingleSignOn valve, share authentication between web applications
Documentation at:
/docs/config/valve
.html -->
<!--
<Valve className=
"org.apache.catalina.authenticator.SingleSignOn"
/>
-->
<!-- Access log processes all example.
Documentation at:
/docs/config/valve
.html
Note: The pattern used is equivalent to using pattern=
"common"
-->
<Valve className=
"org.apache.catalina.valves.AccessLogValve"
directory=
"logs"
prefix=
"localhost_access_log."
suffix=
".txt"
pattern=
"%h %l %u %t "%r" %s %b"
/>
<Context path=
""
docBase=
"/jtbc"
reloadable=
"true"
/>
<
/Host
>
#使用ajp协议实现http代理tomcat
vim
/etc/httpd/httpd
.conf
Include
/etc/httpd/extra/mod_proxy
.conf
vim
/etc/httpd/extra/mod_proxy
.conf
ProxyVia On
ProxyRequests Off
ProxyPreserveHost Off
<Proxy *>
Order allow,deny
Allow from all
<
/Proxy
>
ProxyPass / ajp:
//172
.16.14.3:8009/
ProxyPassReverse / ajp:
//172
.16.14.3:8009/
<Location / >
Order allow,deny
Allow from all
<
/Location
>
|
5、修改JTBC2.0配置文件
1
|
<param-value>jdbc:mysql:
//172
.16.1.31:3306
/jtbc
?user=root&password=centos&useUnicode=
true
&characterEncoding=UTF8<
/param-value
>
|
管理地址:http://ip/admiin
用户名:admin密码:admin
6、修改上传文件的大小
参考博文:http://blog.csdn.net/leshami/article/details/50386792
本文转自1321385590 51CTO博客,原文链接:http://blog.51cto.com/linux10000/1733008,如需转载请自行联系原作者