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

时间:2012-08-15 23:14:19

标签: apache2 jetty

我的ubuntu 12.04服务器配置了两个IP别名: eth0:0 xxx.xxx.xxx.138 和eth0:1 xxx.xxx.xxx.145 我想通过两个不同的应用程序提供两个IP地址: 浏览eth0:0的jetty web应用程序 apache2网站上的eth0:1 那可能吗? 如果我在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>

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>

在码头方面,我有包含

的上下文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>

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

1 个答案:

答案 0 :(得分:1)

为jetty.xml中的连接器设置要监听的ip,我怀疑你现在正在监听所有接口