gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 12:51:16 25 4
gpt4 key购买 nike

我正在我的 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

最佳答案

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

关于apache - 更改 apache2 服务器的 ssl 端口。 (ERR_SSL_PROTOCOL_ERROR),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34304022/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com