apache resin 配置多个项目于一台服务器运行

apache resin 配置多个项目于一台服务器运行

各位老师,Linux爱好者们您们好,学生今日可算能上来提问题了。望众师不吝赐教

还希望众师点评学生如下所做的方法有何不妥,有答必谢,鄙人认为世界上所有人都比我强的,真的,不骗的正所谓三人行必有我师。

学生并非客气,乃是发自肺腑之言,还众师多多赐言。





鄙人表达能力较差,问题很长,望众师细看:



首先

apache与resin整合已成功

整合方法如下:



本人用的是Fedora Core 6 Linux所以先关掉了FC6自带的apache httpd服务

整合方法:

www.apche.org  -> HTTP SERVER -> httpd-2.2 -> 下载了httpd-2.2.4.tar.gz文件

解压到了root用户(为了调试方便用的root登录FC6图形界面进行配置)

www.caucho.com -> download ->下载了 resin-pro-3.0.22.tar.gz

解压到了root用户下 然后移到了 mv /root/resin-pro-3.0.22 /usr/local/resin3 这里。



本人不太会装mysql用的是FC6自带的MySQL5.0 在启动MySQL时遇到了小问题不过花了很长一段时间解决了

这个问题是因鄙人的所用环境是一个通过小型的ADSL 连接到一个100来元钱的小型的hab(或交换机) 能出来的五六个端口的网线连接将它与adsl相连他就是192.168.1.1成为本局域网的主机了。因此网内其它windows机器IP都从192.168.1.2开始向下自动数,也可以打开网页输入192.168.1.1用户名密码均是admin进入这个小交换机的设置页面随意设置网内IP急端口号。不过装完Linux IP自动从100开始自动往下数,本人购得服务器后装完FC6 Linux IP已经成为192.168.1.102即本人将要配置的服务器地址。偶然间修改了本机的主机名为192.168.1.102

FC6的主机名在 /etc/sysconfig/network文件如下:

NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=hero
GATEWAY=192.168.1.1

保存后
mysql就可以正常启动了

安装apache 2.2.4
由于本人是心急者所以安装apache如下
cd ~/./httpd-2.2.4/
./configure
make
make install
完成。这样就安装到了/usr/local/apache2目录下(apache默认目录)
打算运行一下试试报了servername问题,打开/usr/local/apache2/conf/http.conf
找到#ServerName www.example.com:80 在它下面加了一行
ServerName www.hero.com就可以运行了。
cd /usr/local/apache2/bin
启动命令 ./apachectl -k start
在firefox(网页浏览器)中输入http://192.168.1.102回车看到了醒目 It works
结束命令 ./apachectl -k stop

然后本人不安装resin把解压的文件夹直接与apache整合
整合resin-pro-3.0.22
cd /usr/local/resin3
./configure --with-apxs=/usr/local/apache2/bin/apxs --with-apache=/usr/local/apache2
make
make install
在make install之时发现报错,说是有些文件有了就不再建立了,我心话说,行啊,能用就行。但不知对否
然后发现apache配置目录/usr/local/apache2/conf/中的httpd.conf最后多了以下几行字

#
# mod_caucho Resin Configuration
#

LoadModule caucho_module /usr/local/apache2/modules/mod_caucho.so

ResinConfigServer 192.168.1.102 6802
CauchoConfigCacheDirectory /tmp
CauchoStatus yes


就算是成功吧

然后对项目进行解压配置

在配置前本人添加了两个假网卡目的是为了让一个apache和一resin运行两个项目
鄙人在/etc/sysconfig/network-scripts目录中 复制了两个新的ifcfg-eth0文件
这样目录下就有三个文件如下:

文件ifcfg-eth0内容:
# Intel Corporation 80003ES2LAN Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:15:17:11:31:F4

#hero <start>
IPADDR=192.168.1.102
GATEWAY=192.168.1.1
#hero <end>

ONBOOT=yes
TYPE=Ethernet

#hero <start>
IPV6INIT=yes
PEERDNS=yes
#hero <end>

文件ifcfg-eth0:0内容:
# Intel Corporation 80003ES2LAN Gigabit Ethernet Controller (Copper)
DEVICE=eth0:0
# BOOTPROTO=dhcp
BOOTPROTO=static
HWADDR=00:15:17:11:31:F4

#hero <start>
IPADDR=192.168.1.106
GATEWAY=192.168.1.1
#hero <end>

ONBOOT=yes
TYPE=Ethernet

#hero <start>
IPV6INIT=yes
PEERDNS=yes
#hero <end>

文件ifcfg-eth0:1内容:
# Intel Corporation 80003ES2LAN Gigabit Ethernet Controller (Copper)
DEVICE=eth0:1
# BOOTPROTO=dhcp
BOOTPROTO=static
HWADDR=00:15:17:11:31:F4

#hero <start>
IPADDR=192.168.1.109
GATEWAY=192.168.1.1
#hero <end>

ONBOOT=yes
TYPE=Ethernet

#hero <start>
IPV6INIT=yes
PEERDNS=yes
#hero <end>

修改保存完鄙人就重启机器,之后用ifconfig看看网卡IP自我安慰了一下
之所以要这样配是因为顶级域名服务提供商不允许绑定的IP带端口号,但是自己做的项目是两个独立的项目,重改项目等于重做这是万万不能的,所以用这个方法来让resin有不同的ip启不同的项目,然后通过apache虚拟主机访问这些IP的:8080端口从而去掉必須打端口访问到项目,鄙人概念不清实在表达不不清楚众师看看我的配置对不对好不?

resin配置文件resin.conf如下:
<!--
   - Resin 3.0 configuration file.
  -->
<resin xmlns="http://caucho.com/ns/resin"
       xmlns:resin="http://caucho.com/ns/resin/core">
  <!--
     - Logging configuration for the JDK logging API.
    -->
  <log name="" path="stdout:" timestamp="[%H:%M:%S.%s] "/>

  <logger name="com.caucho.java" level="config"/>
  <logger name="com.caucho.loader" level="config"/>

  <!--
     - For production sites, change dependency-check-interval to something
     - like 600s, so it only checks for updates every 10 minutes.
    -->
  <dependency-check-interval>2s</dependency-check-interval>

  <!--
     - You can change the compiler to "javac" or jikes.
     - The default is "internal" only because it's the most
     - likely to be available.
    -->
  <javac compiler="internal" args=""/>

  <!-- Security providers.
     - <security-provider>
     -    com.sun.net.ssl.internal.ssl.Provider
     - </security-provider>
    -->

  <!--
     - If starting bin/resin as root on Unix, specify the user name
     - and group name for the web server user.
     -
     - <user-name>resin</user-name>
     - <group-name>resin</group-name>
    -->

  <!--
     - Configures threads shared among all HTTP and SRUN ports.
    -->
  <thread-pool>
    <!-- Maximum number of threads. -->
    <thread-max>1024</thread-max>

    <!-- Minimum number of spare connection threads. -->
    <spare-thread-min>10</spare-thread-min>
  </thread-pool>

  <!--
     - Configures the minimum free memory allowed before Resin
     - will force a restart.
    -->
  <min-free-memory>1M</min-free-memory>

  <server>
    <!-- adds all .jar files under the resin/lib directory -->
    <class-loader>
      <tree-loader path="${resin.home}/lib"/>
      <tree-loader path="${server.root}/lib"/>
    </class-loader>

    <!-- Configures the keepalive -->
    <keepalive-max>500</keepalive-max>
    <keepalive-timeout>120s</keepalive-timeout>

    <resin:if test="${resin.isProfessional()}">
      <select-manager enable="true"/>
    </resin:if>

    <!-- listen to the http ports only after the server has started. -->
    <bind-ports-after-start/>

    <!-- The http port -->
    <http server-id="" host="*" port="8080"/>

    <!--
       - SSL port configuration:
       -
       - <http port="8443">
       -   <openssl>
       -     <certificate-file>keys/gryffindor.crt</certificate-file>
       -     <certificate-key-file>keys/gryffindor.key</certificate-key-file>
       -     <password>test123</password>
       -   </openssl>
       - </http>
      -->

    <!--
       - The local cluster, used for load balancing and distributed
       - backup.
      -->











    <cluster>
      <srun server-id="a" host="192.168.1.102" port="6802" />
      <srun server-id="c" host="192.168.1.106" port="6806" />
      <srun server-id="b" host="192.168.1.109" port="6809" />
    </cluster>












    <!--
       - Configures the persistent store for single-server or clustered
       - in Resin professional.
      -->
    <resin:if test="${resin.isProfessional()}">
      <persistent-store type="cluster">
        <init path="session"/>
      </persistent-store>
    </resin:if>

    <!--
       - Enables/disables exceptions when the browser closes a connection.
      -->
    <ignore-client-disconnect>true</ignore-client-disconnect>

    <!--
       - For security, use a different cookie for SSL sessions.
       - <ssl-session-cookie>SSL_JSESSIONID</ssl-session-cookie>
      -->

    <!--
       - Enables the cache (available in Resin Professional)
      -->
    <resin:if test="${isResinProfessional}">
      <cache path="cache" memory-size="8M"/>
    </resin:if>

    <!--
       - Enables periodic checking of the server status.
       -
       - With JDK 1.5, this will ask the JDK to check for deadlocks.
       - All servers can add <url>s to be checked.
      -->
    <resin:if test="${isResinProfessional}">
      <ping>
        <!-- <url>http://localhost:8080/test-ping.jsp</url> -->
      </ping>
    </resin:if>

    <!--
       - Defaults applied to each web-app.
      -->
    <web-app-default>
      <!--
         - Extension library for common jar files.  The ext is safe
         - even for non-classloader aware jars.  The loaded classes
         - will be loaded separately for each web-app, i.e. the class
         - itself will be distinct.
        -->
      <class-loader>
        <tree-loader path="${server.root}/ext-webapp"/>
      </class-loader>

      <!--
         - Sets timeout values for cacheable pages, e.g. static pages.
        -->
      <cache-mapping url-pattern="/" expires="5s"/>
      <cache-mapping url-pattern="*.gif" expires="60s"/>
      <cache-mapping url-pattern="*.jpg" expires="60s"/>

      <!--
         - Servlet to use for directory display.
        -->
      <servlet servlet-name="directory"
              servlet-class="com.caucho.servlets.DirectoryServlet"/>

      <!--
         - Enable EL expressions in Servlet and Filter init-param
        -->
      <allow-servlet-el/>

      <!--
         - for security, disable session URLs by default.
        -->
      <session-config>
        <enable-url-rewriting>false</enable-url-rewriting>
      </session-config>

      <!--
         - For security, set the HttpOnly flag in cookies.
         - <cookie-http-only/>
        -->
    </web-app-default>

    <!--
       - Sample database pool configuration
       -
       - The JDBC name is java:comp/env/jdbc/test
         <database>
           <jndi-name>jdbc/mysql</jndi-name>
            <driver type="org.gjt.mm.mysql.Driver">
             <url>jdbc:mysql://localhost:3306/test</url>
             <user></user>
             <password></password>
            </driver>
            <prepared-statement-cache-size>8</prepared-statement-cache-size>
            <max-connections>20</max-connections>
            <max-idle-time>30s</max-idle-time>
          </database>
      -->

    <!--
       - Default host configuration applied to all virtual hosts.
      -->
    <host-default>
      <class-loader>
        <compiling-loader path="webapps/WEB-INF/classes"/>
        <library-loader path="webapps/WEB-INF/lib"/>
      </class-loader>

      <!--
         - With another web server, like Apache, this can be commented out
         - because the web server will log this information.
        -->
      <access-log path="logs/access.log"
            format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"'
            rollover-period="1W"/>

      <!-- creates the webapps directory for .war expansion -->
      <web-app-deploy path="webapps"/>

      <!-- creates the deploy directory for .ear expansion -->
      <ear-deploy path="deploy">
        <ear-default>
          <!-- Configure this for the ejb server
             -
             - <ejb-server>
             -   <config-directory>WEB-INF</config-directory>
             -   <data-source>jdbc/test</data-source>
             - </ejb-server>
            -->
        </ear-default>
      </ear-deploy>

      <!-- creates the deploy directory for .rar expansion -->
      <resource-deploy path="deploy"/>

      <!-- creates a second deploy directory for .war expansion -->
      <web-app-deploy path="deploy"/>
    </host-default>

    <!-- includes the web-app-default for default web-app behavior -->
    <resin:import path="${resin.home}/conf/app-default.xml"/>

    <!-- configures a deployment directory for virtual hosts -->
    <host-deploy path="hosts">
      <host-default>
        <resin:import path="host.xml" optional="true"/>
      </host-default>
    </host-deploy>

    <!-- configures the default host, matching any host name -->






    <host id="192.168.1.109" root-directory=".">
      <web-app id="/" document-directory="/var/www/html/hero/WebRoot"/>
      <resin:if test="${java.isJava5()}">
        <resin:set var="resin_admin_password"  default=""/>
        <resin:set var="resin_admin_localhost" default="true"/>
        <web-app id="/resin-admin" document-directory="${resin.home}/php/admin"/>
      </resin:if>
   </host>


   <host id="192.168.1.106" root-directory=".">
      <web-app id="/" document-directory="/var/www/html/hero2/WebRoot"/>
      <resin:if test="${java.isJava5()}">
        <resin:set var="resin_admin_password"  default=""/>
        <resin:set var="resin_admin_localhost" default="true"/>
        <web-app id="/resin-admin" document-directory="${resin.home}/php/admin"/>
      </resin:if>
   </host>
   

   <host id="192.168.1.102" root-directory=".">
      <!--
         - configures an explicit root web-app matching the
         - webapp's ROOT
        -->
      <web-app id="/" document-directory="webapps/ROOT"/>
      <resin:if test="${java.isJava5()}">
        <!--
           - Administration application /resin-admin
           -
           - password is the md5 hash of the password.
           - localhost is true to limit access to the localhost
          -->
        <resin:set var="resin_admin_password"  default=""/>
        <resin:set var="resin_admin_localhost" default="true"/>
        <web-app id="/resin-admin" document-directory="${resin.home}/php/admin"/>
       </resin:if>
    </host>


  </server>
</resin>





resin配置文件结束

[ 本帖最后由 lmp4h7 于 2007-8-9 10:29 编辑 ]
apche配置文件httpd.conf如下:
#
# 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" will be interpreted by the
# server as "/usr/local/apache2/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"

#
# 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
#

<IfModule !mpm_netware_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.  
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User daemon
Group daemon
</IfModule>

# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition.  These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#

#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin@your-domain.com
#
ServerAdmin you@example.com

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
ServerName www.hero.com

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/usr/local/apache2/htdocs"

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.  
#
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/usr/local/apache2/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

</Directory>




#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html index.jsp
</IfModule>

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>

#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog logs/error_log

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

<IfModule log_config_module>
    #
    # The following directives define some format nicknames for use with
    # a CustomLog directive (see below).
    #
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    #
    # The location and format of the access logfile (Common Logfile Format).
    # If you do not define any access logfiles within a <VirtualHost>
    # container, they will be logged here.  Contrariwise, if you *do*
    # define per-<VirtualHost> access logfiles, transactions will be
    # logged therein and *not* in this file.
    #
    CustomLog logs/access_log common

    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #bizi/behindCSS/
    #CustomLog logs/access_log combined
</IfModule>

<IfModule alias_module>
    #
    # Redirect: Allows you to tell clients about documents that used to
    # exist in your server's namespace, but do not anymore. The client
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.example.com/bar

    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.

    #
    # ScriptAlias: This controls which directories contain server scripts.
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"

</IfModule>

<IfModule cgid_module>
    #
    # ScriptSock: On threaded servers, designate the path to the UNIX
    # socket used to communicate with the CGI daemon of mod_cgid.
    #
    #Scriptsock logs/cgisock
</IfModule>

#
# "/usr/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/usr/local/apache2/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain

<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig conf/mime.types

    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    #
    # AddHandler allows you to map certain file extensions to "handlers":
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action directive (see below)
    #
    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    #AddHandler cgi-script .cgi

    # For type maps (negotiated resources):
    #AddHandler type-map var

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml
</IfModule>

#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type.  The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic

#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#

#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files.  This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off

# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.

# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf

# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf

# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf

# Language settings
#Include conf/extra/httpd-languages.conf

# User home directories
#Include conf/extra/httpd-userdir.conf

# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf

# Various default settings
#Include conf/extra/httpd-default.conf

# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
#       starting without SSL on platforms with no /dev/random equivalent
#       but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
#
# mod_caucho Resin Configuration
#

LoadModule caucho_module /usr/local/apache2/modules/mod_caucho.so

ResinConfigServer 192.168.1.102 6802
ResinConfigServer 192.168.1.106 6806
ResinConfigServer 192.168.1.109 6809
CauchoConfigCacheDirectory /tmp
CauchoStatus yes

<Location /caucho-status>
  SetHandler caucho-status
</Location>

<VirtualHost 192.168.1.109:80>


    ServerAdmin webmaster@dummy-host.example.com

    DocumentRoot /var/www/html/hero/WebRoot

    ServerName 192.168.1.109

    ErrorLog logs/dummy-host.example.com-error_log

    CustomLog logs/dummy-host.example.com-access_log common
   
    <Directory "/var/www/html/hero/biziRoot">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
   </Directory>

</VirtualHost>

<VirtualHost 192.168.1.106:80>


    ServerAdmin webmaster@dummy-host.example.com

    DocumentRoot /var/www/html/hero2/WebRoot

    ServerName 192.168.1.106

    ErrorLog logs/dummy-host.example.com-error_log

    CustomLog logs/dummy-host.example.com-access_log common

    <Directory "/var/www/html/hero2/WebRoot">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
   </Directory>
</VirtualHost>





apache配置文件结束
虽然没有成功,但是我最终订下了我这条思路发到网上来,思路就是apache和resin默认的不去更改,虽然更改项目运行很好但是只能通过apache运行一个项目,我的首目标是运行两个项目,必須另找他法。所以本人用virtualHost来起动两个项目。。
先启动了resin 就是进入/usr/local/resin3/bin/下运行./httpd.sh命令然后在另一个终端进入/usr/local/apache2/bin/目录下运行./apachectl -k start命令均运行成功没报错。
然后在firefox中敲http://192.168.1.102/caucho-status      回车,成功显示了所有端口运行的项根目录
再在firefox中开一个标签敲http://192.168.1.106    回车成功的显示了hero2项目的目录文件(因为hero2没有index.jsp和index.html)(其实是错误的只要运行jsp就发出如109)
最后在firefox中开一个标签敲http://192.168.1.109    回车显示了

如下错误
Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

望众师赐教
服务模块无效?
califord , 您好 我不太懂这里的模块,不过问题有了进展

Apache配置方案:
在刚刚安装好的最原始的配置好resin的httpd.conf中添加或更改如下:

在这个地方
#ServerName www.example.com:80 加入ServerName,目的是为了局域网内启动服务
ServerName www.顶级域名壹.com     无所谓,这里起什么名都行

找到这个地方添加一个 空格 index.jsp
<IfModule dir_module>
    DirectoryIndex index.html index.jsp
</IfModule>

如果成功整合了resin,  httpd.conf中就会有这样的话:
#
# mod_caucho Resin Configuration
#
LoadModule caucho_module /usr/local/apache2/modules/mod_caucho.so
ResinConfigServer 127.0.0.1 6802
CauchoConfigCacheDirectory /tmp
CauchoStatus yes
我将 ResinConfigServer 127.0.0.1 6802 这里的IP与resin.conf中如下对应
<cluster>
      <srun server-id="" host="127.0.0.1" port="6802"/>
</cluster>

继续我在末尾添加如下为的是查看caucho-status
<Location /caucho-status>
  SetHandler caucho-status
</Location>

然后我开始在httpd.conf中配置我的Apache 虚拟主机
添加第一个虚拟主机:这里的192.168.1.100在前面的贴子中鄙人已经讲过是我/etc/sysconfig/network-scripts/ifcfg-eth0文件我的网卡 内部IP地址为192.168.1.100
<VirtualHost 192.168.1.100:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /var/www/html/项目壹/WebRoot
    ServerName 192.168.1.100
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common
    <Directory "/var/www/html/项目壹/WebRoot">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

</Directory>
</VirtualHost>

添加第二个虚拟主机对应的是/etc/sysconfig/network-scripts/ifcfg-eth0:0文件我的虚拟假网卡内部IP地址为192.168.1.106
<VirtualHost www.顶级域名贰.com>

    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /var/www/html/项目贰/WebRoot
    ServerName www.顶级域名贰.com
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common

    <Directory "/var/www/html/项目贰/WebRoot">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

</Directory>
</VirtualHost>
以上是虚拟主机apache配置文件httpd.conf中默尾添加的
同样在resin.conf中要有与其相对应,我只改了resin.conf三处地方

第一处找到<http>:
<!-- The http port -->
    <http server-id="" host="192.168.1.100" port="8080"/>
    <http server-id="" host="192.168.1.106" port="8080"/>

第二处找到<srun>:
<cluster>
      <srun server-id="" host="127.0.0.1" port="6802"/>
</cluster>

第三处我找到<host>删除默认的添加了两个host为的是与apache相对应
<host id="www.顶级域名壹.com" root-directory=".">
      <web-app id="/" document-directory="/var/www/html/项目壹/WebRoot"/>
      <resin:if test="${java.isJava5()}">
        <resin:set var="resin_admin_password"  default=""/>
        <resin:set var="resin_admin_localhost" default="true"/>
        <web-app id="/resin-admin" document-directory="${resin.home}/php/admin"/>
       </resin:if>
    </host>

    <host id="www.顶级域名贰.com" root-directory=".">
      <web-app id="/" document-directory="/var/www/html/项目贰/WebRoot"/>
      <resin:if test="${java.isJava5()}">
        <resin:set var="resin_admin_password"  default=""/>
        <resin:set var="resin_admin_localhost" default="true"/>
        <web-app id="/resin-admin" document-directory="${resin.home}/php/admin"/>
       </resin:if>
    </host>

以上是在下与同学千锤百炼得到的成功一半的例子
就是在网上敲入www.顶级域名壹.com项目起动的是192.168.1.100resin起动的项目
同上同理再敲入www.顶级域名贰.com项目起动的是192.168.1.106resin起动的项目
但是第二个项目虽然功能较正常但是没有css 没有了图片也就是凡是涉及到路径的地方都没有但是servlet正常转方没问题。显示数据库内容没问题,后来发现项目路径有问题将两个项目对掉。问题也是一样,只不过是顶级域名贰的项目正常,壹的项目就没css了,也就正明了项目没问题,一定是httpd.conf或resin.conf的错,若众师需要改动哪里进行测试,我可以代劳把测试结果发布到这里供大家研究。

[ 本帖最后由 lmp4h7 于 2007-8-16 10:09 编辑 ]