繁体   English   中英

更改apache2服务器的ssl端口。 (ERR_SSL_PROTOCOL_ERROR)

[英]Change ssl port of apache2 server. (ERR_SSL_PROTOCOL_ERROR)

我正在EC2实例上开发apache2环境。 为了安全起见,我想更改apache2的ssl端口。 我已经确认默认的ssl端口443正在使用chrome浏览器检查页面。 但是在修改了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

我自己找到了答案。 我还需要编辑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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM