首页 文章

尽管启用了防火墙,Tomcat仍然使用端口:443并且不使用:80

提问于
浏览
1

我有Tomcat连接器的问题 . 当我尝试使用SSL连接时,它可以工作,我可以访问该页面(https://nombritech.pl) . 我希望能够从端口80重定向到443,但如果我尝试连接http,我无法访问该页面(http://nombritech.pl) .

我指定的这些连接器有问题吗?我想我已经完成了一切,就像我在其他线程中看到的一样 .

<Connector port="80" redirectPort="443" protocol="HTTP/1.1" connectionTimeout="20000" />
    <Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" KeystoreFile="/opt/tomcat/certificate/nombritech.pl.keystore" keystorePass="pass" />

我看不到任何通过端口80的流量:

enter image description here

我在Ubuntu 17.10和Tomcat 9 beta 2上运行它 .

编辑:我认为它可能在ipv6而不是ipv4上运行:

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:5355            0.0.0.0:*               LISTEN      23950/systemd-resol
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      1151/dnsmasq
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      851/vsftpd
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      19096/sshd
tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN      940/postgres
tcp        0      0 127.0.0.1:5433          0.0.0.0:*               LISTEN      939/postgres
tcp        0    464 79.137.81.193:22        29.72.22.156:52036      ESTABLISHED 20310/sshd: root@pt
tcp        0    136 79.137.81.193:22        29.72.22.156:53406      ESTABLISHED 27828/sshd: root@no
tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      27741/java
tcp6       0      0 :::5355                 :::*                    LISTEN      23950/systemd-resol
tcp6       0      0 :::80                   :::*                    LISTEN      27741/java
tcp6       0      0 :::22                   :::*                    LISTEN      19096/sshd
tcp6       0      0 :::5432                 :::*                    LISTEN      940/postgres
tcp6       0      0 :::443                  :::*                    LISTEN      27741/java
udp        0      0 0.0.0.0:5355            0.0.0.0:*                           23950/systemd-resol
udp        0      0 127.0.0.1:54514         127.0.0.1:54514         ESTABLISHED 939/postgres
udp        0      0 127.0.0.53:53           0.0.0.0:*                           23950/systemd-resol
udp        0      0 192.168.122.1:53        0.0.0.0:*                           1151/dnsmasq
udp        0      0 0.0.0.0:67              0.0.0.0:*                           1151/dnsmasq
udp        0      0 0.0.0.0:68              0.0.0.0:*                           740/dhclient
udp        0      0 127.0.0.1:58536         127.0.0.1:58536         ESTABLISHED 940/postgres
udp6       0      0 :::5355                 :::*                                23950/systemd-resol

EDIT2: 我将其更改为tcp但它 still doesn't respond 更改为http:

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      28573/java

端口80像以前一样关闭 . 你对我现在可以用它做什么有什么想法吗?我会非常感谢有关此事的任何暗示 .

编辑:现在它工作,如果我有端口连接器:8080和:443,:80仍然没有't work, although it has been enabled in firewall and I'm以root身份运行Tomcat, why can't I run it on :80 then? Tomcat侦听端口:80并且连接始终被拒绝

编辑:

我当前的server.xml:

<Service name="Catalina">
    <Connector port="80" redirectPort="443" protocol="HTTP/1.1" connectionTimeout="20000" address="0.0.0.0"/>
    <Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" KeystoreFile="/opt/tomcat/certificate/nombritech.pl.keystore" keystorePass="pass" />
    <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"></Host>
    </Engine>
</Service>

1 回答

  • 0

    我重新安装了我的Ubuntu服务器,现在它按预期工作 . 我不知道这个问题的确切原因,但它一直是防火墙或其他网络相关问题的问题,因为Tomcat配置与以前一样 .

    感谢您对此事的帮助,我很高兴它开始工作:) . 我希望我知道为什么它没有奏效 .

相关问题