无法使用apache / centos提供https

时间:2014-04-12 00:46:26

标签: apache ssl https centos httpd.conf

我在CentOS上设置了apache服务器。我正在尝试添加SSL。我能够创建证书和密钥,然后更新/etc/httpd/conf.d/ssl.conf以进行以下配置:

/etc/httpd/conf.d/ssl.conf

#Where I put my cert
SSLCertificateFile /etc/pki/tls/certs/ca.crt

#where I put my key
SSLCertificateKeyFile /etc/pki/tls/private/ca.key

然后我更新了/etc/httpd/conf/httpd.conf

/etc/httpd/conf/httpd.conf中

Listen 443
NameVirtualHost *:443

<VirtualHost *:443>
    SSLEngine on
    SSLCertificateFile /etc/pki/tls/certs/ca.crt
    SSLCertificateKeyFile /etc/pki/tls/private/ca.key
</VirtualHost>

然后我跑service httpd restart,一切正常

Stopping httpd:          [OK]
Starting httpd:          [OK]

但是当我使用https访问我的网站时,它说“此网页不可用”。我需要做什么来启用https?

1 个答案:

答案 0 :(得分:0)

我忘了打开iptables中的443端口:apache and httpd running but I cant see my website

要更改此项(在Centos 6上),请将以下行添加到文件/etc/sysconfig/iptables

-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT

您需要确保这是 任何限制全局访问的行。