我在标准Alpine Linux / 3.9.0上配置https,运行PHP / 7.2.14和lighttpd / 1.4.52(ssl)。我有我的域名(我称之为“mydomain.com”),我得到了ssl文件mydomain.crt,mydomain.p7b,mydomain.ca-bundle,mydomain.key和mydomain.pem。
- 当我在mydomain.com:443上使用http搜索时,我访问了我的网站。
- 当我在mydomain.com上使用https搜索时,连接超时。
我错误地配置了/etc/lighttpd/lighttpd.conf,我认为它与我的“.crt”文件有关。我搜索了StackOverflow并通过谷歌搜索,但最有用的两个来源是:
https://tecadmin.net/configure-ssl-in-lighttpd-server/ https://www.digicert.com/ssl-certificate-installation-lighttpd.htm
这是在默认配置文件/etc/lighttpd/lighttpd.conf中添加/修改的:
server.port = 443
$SERVER["socket"] == ":443" {
ssl.engine = "enable"
ssl.pemfile = "/etc/lighttpd/mydomain.pem"
ssl.ca-file = "/etc/lighttpd/mydomain.crt"
server.name = "mydomain"
server.document-root = "/var/www/localhost/htdocs"
}
我也试过更换 ssl.ca-file =“/ etc / lighttpd / mydomain.crt” 同 ssl.ca-file =“/ etc / lighttpd / mydomain.ca-bundle”
我希望/etc/lighttpd/mydomain.crt能够正常工作,但我只能通过http(成功连接)访问端口443,而不能通过https(连接超时)访问。我有一个.crt文件(mydomain.crt)。我应该将文件mydomain.ca-bundle修改为.crt文件吗?
好的,所以犯罪者就是这条线:
server.port = 443
我是这样的新手,我没有意识到你应该打开端口80和端口443以启用https。 lighttpd默认使用80,所以我只需要注释掉这一行:
# server.port = 443
请注意未来的读者:因此,对于https,端口80和443也必须在您的路由器上移植。