【问题标题】:Tomcat with https a non-root user - Bind exception 443具有 https 非 root 用户的 Tomcat - 绑定异常 443
【发布时间】:2011-10-27 05:19:28
【问题描述】:

我想以非 root 用户 (https://machinIP) 在端口 443 上运行 tomcat。我收到以下错误:

Error initializing endpoint java.net.BindException: Permission denied:443

我肯定没有使用 443 端口。我在某处读到我们不能使用非 root 用户的端口 443,而替代方法是使用 iptables,但我不知道究竟如何使用 iptables..

如果有人能给我 iptables 的确切命令以及我是否需要对 server.xml 进行任何更改,我将不胜感激?当前 server.xml 使用端口 8080 用于 http,端口 8443 用于 https。

谢谢!

【问题讨论】:

    标签: tomcat bind


    【解决方案1】:

    作为非 root 用户,您无法绑定端口 443。server.xml 包含 ssl 端口的绑定,您已经提到它是为 8443 设置的。不确定它从哪里获得 443。您有权访问 conf 文件夹吗?你能搜索一下 443 看看是否有什么有用的信息吗?

    【讨论】:

    • 哦...抱歉没有澄清。我将 server.xml 中的 8443 更改为 443,因为我需要通过 https 访问我的网站://IP 如何使用非 root 用户进行操作
    • 你不能,但你可以使用代理(例如 apache)
    • 代理是一种选择,iptables 是另一种选择。我个人没有为这个特定的设置尝试过 iptables,但我用谷歌搜索了它,它看起来很简单。以下是解决方案之一。 distriwatch.de/2010/06/iptables-forward-port-8443-to-port-443
    • 我按照上面的链接尝试了 iptables,我没有收到任何错误,这是一件好事。但是,当我点击 URL https://myip 时,我得到“页面无法显示”,它甚至没有点击服务器并且根本没有日志。可能是什么原因?如果我想使用 Maurice 提到的另一种使用代理的方法,我需要做什么?你能解释一下吗?
    • iptables 甚至在服务器上运行吗?运行链接中提到的 iptables 命令后(以 root 用户身份),如果 iptables 未运行,则需要启动它。要启动 iptables,请以 root 用户身份运行以下命令“service iptables start”。要检查 iptables 的状态,请运行“service iptables status”
    【解决方案2】:

    它对我有用:-)

     wget http://download.si-linux.co.jp/debian-mirror/squeeze_20120726/pool/main/a/authbind/authbind_1.2.0.tar.gz
    

    解压缩 > CD > 制作 > 制作安装

        sudo touch /etc/authbind/byport/443
        sudo chmod 500 /etc/authbind/byport/443
        sudo chown <non_root_user> /etc/authbind/byport/443
    
        vim tomcat/bin/startup.sh
        exec authbind --deep "$PRGDIR"/"$EXECUTABLE" start "$@"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-15
      • 1970-01-01
      • 1970-01-01
      • 2017-12-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多