大网数据广告活动
服务器运维问答

Apache2 not listening on SSL on Ubuntu

· 52CE 我爱测

Trying the configure SSL on Apache2 on Ubuntu server installed Apache sudo apt install apache2 Opened ufw firewall sudo ufw allow 'Apache' ufw allow https Installed SSL files in /root/cert chmod 400 /root/cert/* chmod 500 /root/c…

问题原文

原帖链接 · vrao · CC BY-SA 4.0

Trying the configure SSL on Apache2 on Ubuntu server installed Apache

sudo apt install apache2

Opened ufw firewall

sudo ufw allow 'Apache'
ufw allow https

Installed SSL files in /root/cert

 chmod 400 /root/cert/*
  chmod 500 /root/cert/

In /etc/apache2/sites-available found two conf files: domainname.conf and default-ssl.conf DId not know which one to modify, so modified domainname.conf by adding following lines

 <VirtualHost *:443>
    SSLEngine on
    SSLCertificateFile /root/cert/ca-bundle.crt
        SSLCertificateKeyFile /root/cert/Private.key
        SSLCertificateChainFile /root/cert/certificate.crt
   </VirtualHost>

apachectl configtest
apachectl restart
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
systemctl enable apache2 --now 
netstat -ntlp |  grep 80
tcp6       0      0 :::80                   :::*                    LISTEN      899/apache2  

netstat -ntlp |  grep 443

returns nothing

Added information - the website DNS resolution has not happened yet, because the nameserver is being changed. So I am checking on localhost. localhost:80 works, localhost:443 does not work gives error: localhost refused to connect

Several questions:

  1. have I switched files SSLCertificateFile SSLCertificateChainFile by mistake since I did not which one was which. Also it has comment statement -----BEGIN CERTIFICATE----- and -----BEGIN CERTIFICATE-----

  2. When I perform

    apache2ctl configtest it says AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message Syntax OK

Is this a problem since nameserver is still pointing to old provider and I am in process of switching to new provider nameserver where the new website is running.

Can anyone help?

已采纳解答

原帖链接 · Gerald Schneider · CC BY-SA 4.0

If the Apache process is not listening on port 443 you are missing the Listen 443 directive in your configuration. It should be enabled by default if the ssl module is active, so make sure the module is loaded.

sudo a2enmod ssl

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2023-11-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。