使用apache2和jetty监听2个IP别名?

使用apache2和jetty监听2个IP别名?,apache2,jetty,Apache2,Jetty,我的ubuntu 12.04服务器配置了两个IP别名: eth0:0 xxx.xxx.xxx.138 和eth0:1 xxx.xxx.xxx.145 我想通过两个不同的应用程序为这两个IP地址提供服务: jetty web应用程序在eth0:0上侦听 eth0:1上的apache2网站 可能吗? 如果我在eth0:1地址上启动jetty,只要apache2停止,它就可以正常工作。 当我启动apache 2时,我得到以下信息: * Starting web server apache2

我的ubuntu 12.04服务器配置了两个IP别名: eth0:0 xxx.xxx.xxx.138 和eth0:1 xxx.xxx.xxx.145 我想通过两个不同的应用程序为这两个IP地址提供服务: jetty web应用程序在eth0:0上侦听 eth0:1上的apache2网站 可能吗? 如果我在eth0:1地址上启动jetty,只要apache2停止,它就可以正常工作。 当我启动apache 2时,我得到以下信息:

 * Starting web server apache2                                              

    apache2: Could not reliably determine the server's fully qualified domain name, using xxx.xxx.xxx.138 for ServerName
(98)Address already in use: make_sock: could not bind to address xxx.xxx.xxx.145:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
Apache2配置是标准配置,侦听指令包含xxx.xxx.xxx.145:

port.conf:

#NameVirtualHost xxx.xxx.xxx.145:80
Listen xxx.xxx.xxx.145:80

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
    Listen xxx.xxx.xxx.145:443
</IfModule>

<IfModule mod_gnutls.c>
    Listen xxx.xxx.xxx.145:443
</IfModule>
#名称虚拟主机xxx.xxx.xxx.145:80
听xxx.xxx.xxx.145:80
#如果在此处添加NameVirtualHost*:443,则还必须进行更改
#/etc/apache2/sites available/default ssl中的VirtualHost语句
#到
#SSL命名虚拟主机的服务器名称指示当前不可用
#由Windows XP上的MSIE支持。
听xxx.xxx.xxx.145:443
听xxx.xxx.xxx.145:443
000违约

<VirtualHost xxx.xxx.xxx.145:80>
        ServerAdmin webmaster@localhost
        ServerName mquagliani
        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
 <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

服务器管理员webmaster@localhost
服务器名mquagliani
DocumentRoot/var/www
选项如下符号链接
不允许超限
选项索引跟随符号链接多视图
不允许超限
命令允许,拒绝
通融
ScriptAlias/cgi-bin//usr/lib/cgi-bin/
不允许超限
选项+执行CGI-多视图+符号链接所有者匹配
命令允许,拒绝
通融
ErrorLog${APACHE_LOG_DIR}/error.LOG
#可能的值包括:调试、信息、通知、警告、错误、临界值、,
#警惕,埃默格。
日志级别警告
CustomLog${APACHE\u LOG\u DIR}/access.LOG组合
别名/doc/“/usr/share/doc/”
选项索引多视图跟随符号链接
不允许超限
命令拒绝,允许
全盘否定
允许从127.0.0.0/255.0.0.0::1/128开始
在jetty端,我的上下文mtc.xml包含

<Set name="virtualHosts">
    <Array type="String">
      <Item>www.mindthecheck.com</Item>
      <Item>xxx.xxx.xxx.138</Item>
      <Item>localhost</Item>
      <Item>127.0.0.1</Item>
    </Array>
  </Set>

www.mindtheck.com
xxx.xxx.xxx.138
本地服务器
127.0.0.1

我错在哪里?我不想让apache作为代理,因为这会减慢jetty应用程序的速度。我只想让jetty和apache从两个不同的IP地址进行侦听。

在jetty.xml中为连接器设置要侦听的IP,我怀疑您现在正在侦听所有接口

我将查看它,但这可以解释“地址已在使用”apache错误,对吗?为什么apache也在抱怨另一个地址(xxx.xxx.xxx.138,配置文件中apache没有引用的地址)?当然,如果jetty出现在所有接口的端口X上,那么其他任何人都无法在任何接口上打开该端口完成。显示错误98(地址已在使用中),apache可以启动,但警告“apache2:无法可靠地确定服务器的完全限定域名,使用xxx.xxx.xxx.138作为服务器名”仍然存在。正如我之前所问的,如果apache应该只听x.145,为什么apache会在x.138(只有jetty听它)上抱怨呢?对不起,我只能说硬币的jetty一面,我怀疑这在apache中是类似的,或者只是一个方便的“警告”,提醒他们可能存在配置错误。我在apache2目录中搜索了x.138,但没有找到任何东西。据我所知,使用听力指令应该足够了,但可能不是。