Apache2和tomcat 7在ubuntu服务器上运行出错

Apache2和tomcat 7在ubuntu服务器上运行出错

我在 ubuntu 上安装了 apache 2.2.22 和 tomcat 7,并部署了 ROOT.war 在 catalina.log 文件中出现此错误: 无法初始化与 ProtocolHandler [“http-bio-80”] 关联的端点 java.net.BindException:权限被拒绝:80

服务器.xml

<Server port="8005" shutdown="SHUTDOWN">

    <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
    <Listener className="org.apache.catalina.core.JasperListener" />
    <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
    <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

    <Service name="Catalina">

        <Connector port="80" protocol="HTTP/1.1" maxThreads="200"
                   maxHttpHeaderSize="21000" connectionTimeout="20000" 
                   redirectPort="443" compression="on" 
                   compressionMinSize="2048" 
                   noCompressionUserAgents="gozilla, traviata"
                   compressableMimeType="text/html,text/xml,text/javascript,application/x-javascript,application/javascript" />

        <Connector port="443" protocol="org.apache.coyote.http11.Http11Protocol"
                    SSLEnabled="true" maxHttpHeaderSize="21000" 
                    maxThreads="200" scheme="https"
                    secure="true" keystoreFile="path"
                    keystorePass="" clientAuth="false" 
                    sslProtocol="TLS" />

        <!-- Define an AJP 1.3 Connector on port 8009 -->

        <Connector port="8009" protocol="AJP/1.3" redirectPort="443" />

       <Engine name="Catalina" defaultHost="localhost">

          <Realm className="org.apache.catalina.realm.LockOutRealm">
           <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
            resourceName="UserDatabase" />
        </Realm>

       <Host name="localhost" appBase="webapps" unpackWARs="true"
        autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
        <Context path="" docBase="ROOT" debug="0" reloadable="true">
            <WatchedResource>WEB-INF/web.xml</WatchedResource>
        </Context>
    </Host>
    </Engine>
 </Service>
  </Server>

工人.属性:

worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009

apache2.conf

# Include the virtual host configurations:
Include sites-enabled/

JkShmFile /var/log/apache2/mod_jk.shm
JkLogFile /var/log/apache2/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

Include sites-available/default-ssl

/etc/apache2/sites-enabled/000-默认

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

   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 combine

  JkMount /* worker1

   </VirtualHost>

答案1

快速回答是:您有:<Connector port="80" ...告诉 tomcat 绑定到端口 80。您还将 Apache 设置为绑定到端口 80。您可能想要禁用/删除端口 80 和端口 443 的连接器部分。

如果您希望能够在没有 apache 的情况下调试 tomcat,您可能需要将这些连接器更改为 8080 和 8443。

相关内容