欢迎来到 黑吧安全网 聚焦网络安全前沿资讯,精华内容,交流技术心得!

Linux下配置Apache2.2+Tomcat6的虚拟主机配置之tomcat-connectors

来源:本站转载 作者:佚名 时间:2011-03-20 TAG: 我要投稿

目标,在Linux进行apache2.2版本和tomcat6版本的虚拟主机配置。有些时候apache2.2是不能将请求转发给tomcat的(例如直接处理静态页面的显示),所以我们直接用ajp代理之类的简单策略就没有办法区分动态项目和静态项目处理方式了。在这个方面,tomcat早有准备,推出了tomcat-connectors进行了支持。

前期安装:

1、apache已经完全安装到了/usr/local/apache2.2目录下了,web服务端口是80。启动后是apache的it works!提示



2、tomcat6已经安装到了/usr/local/tomcat6目录下了。8009端口开发,web服务端口是8080。启动后是tomcat的默认页。

我在tomcat6的webapps下已经部署了两个jsp项目MicTrader 和MicSeller。通过

http://ip:8080/MicTrader和http://ip:8080/MicSeller能访问

3、jdk已经安装了,并且上边的两个服务已经可用了

4、linux的RedHat4版本,相关编译包已经ok了

下载:

1、connector包:Apache Tomcat Connectors (mod_jk) 1.2.30 for Linux i586

命令:wget http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.30/i586/mod_jk-1.2.30-httpd-2.2.X.so

注意:http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.30/i586/这个页面有介绍当前版本支持的linux版本以及apache和tomcat的版本,千万别下载错了版本,否则linux的系统不支持访问

2、下载后的so文件名:mod_jk-1.2.30-httpd-2.2.X.so
将文件拷贝并重命名到:/usr/local/apache2.2/modules/mod_jk.so

给文件赋予系统读写权限:cd /usr/local/apache2.2/modules

chmod 777 mod_jk.so

3、进行相关文件的配置(操作前请备份一份)

(1)、配置httpd.conf。注意内部标注add by kongqz的地方。都是我加上去的。主要是进行了mod_jk.so模块加载,以及虚拟主机的配置两个配置工作
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo_log"
# with ServerRoot set to "/usr/local/apache2.2" will be interpreted by the
# server as "/usr/local/apache2.2/logs/foo_log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/usr/local/apache2.2"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so

[1] [2] [3] [4] [5]  下一页

【声明】:黑吧安全网(http://www.myhack58.com)登载此文出于传递更多信息之目的,并不代表本站赞同其观点和对其真实性负责,仅适于网络安全技术爱好者学习研究使用,学习中请遵循国家相关法律法规。如有问题请联系我们,联系邮箱admin@myhack58.com,我们会在最短的时间内进行处理。
  • 最新更新
    • 相关阅读
      • 本类热门
        • 最近下载