【问题标题】:Change ssl port of apache2 server. (ERR_SSL_PROTOCOL_ERROR)更改 apache2 服务器的 ssl 端口。 (ERR_SSL_PROTOCOL_ERROR)
【发布时间】:2016-03-22 02:48:40
【问题描述】:

我正在我的 EC2 实例上开发 apache2 环境。为了安全起见,我想更改 apache2 的 ssl 端口。 我已经通过使用 chrome 浏览器检查页面来确认默认 ssl 端口 443 正在工作。但是在像下面这样修改ports.conf之后,我遇到了一个错误,ERR_SSL_PROTOCOL_ERROR在访问这个服务器时像https://xxxxxxx:18443/

有更改ssl端口的设置吗?

监听端口

$ ss -lnt
State       Recv-Q Send-Q                         Local Address:Port                           Peer Address:Port
LISTEN      0      128                                        *:22                                        *:*
LISTEN      0      64                                         *:7777                                      *:*
LISTEN      0      50                                 127.0.0.1:3306                                      *:*
LISTEN      0      128                                       :::22                                       :::*
LISTEN      0      128                                       :::18443                                    :::*

/etc/apache2/ports.conf

#Listen 80

<IfModule ssl_module>
        Listen 18443
</IfModule>

<IfModule mod_gnutls.c>
        Listen 18443
</IfModule>

环境

  • 操作系统:ubuntu 14.04 服务器 (Amazon/EC2 AMI)
  • apache:Apache/2.4.7 (Ubuntu)

EC2 入站安全策略

Custom TCP rule: TCP, 18443, 0.0.0.0/0
Custom UDP rule: UDP, 18443, 0.0.0.0/0

【问题讨论】:

    标签: apache ssl amazon-ec2 https apache2


    【解决方案1】:

    我自己找到了答案。我还需要编辑 default-ssl.conf。因此,我总结了设置 ssl 和更改其端口的所有过程。在本例中,我将 ssl 端口从 443 更改为 18443。

    $ sudo apt-get install apache2
    $ sudo a2enmod ssl
    $ sudo a2ensite default-ssl
    $ sudo service apache2 restart
    $ ss -lnt
    State      Recv-Q Send-Q        Local Address:Port          Peer Address:Port
    LISTEN     0      128                      :::443                     :::*
    LISTEN     0      128  
    

    然后,尝试更改 ssl 端口。

    $ sudo vi /etc/apache2/ports.conf
    <IfModule ssl_module>
            Listen 18443
    </IfModule>
    <IfModule mod_gnutls.c>
            Listen 18443
    </IfModule>
    

    在这个设置中,我使用了default-ssl,所以我也必须修改这个文件。

     $ sudo vi /etc/apache2/sites-available/default-ssl.conf
     <IfModule mod_ssl.c>
       <VirtualHost _default_:18443>
       ...
    

    然后重启apache2就可以访问http://xxxxxx:18443/

    $ sudo service apache2 restart
    

    【讨论】:

      猜你喜欢
      • 2021-07-01
      • 1970-01-01
      • 2015-06-18
      • 2021-12-01
      • 1970-01-01
      • 2011-01-24
      • 1970-01-01
      • 1970-01-01
      • 2013-07-17
      相关资源
      最近更新 更多