如何在Ubuntu中的Apache服务器中安装SSL证书
问题描述:
我想输入 https://localhost 之类的本地主机,我需要使用ssl进行此操作.如何在Ubuntu的Apache服务器中安装SSL证书?
I want enter localhost like a https://localhost, I need to do this with ssl. How to install SSL certificate in apache server in ubuntu?
预先感谢
答
您必须将证书添加到VirtualHost
部分的httpd.conf
文件中,并将端口更改为433.最小配置如下所示:
You have to add your certificate to your httpd.conf
file in the VirtualHost
section and change the port to 433. A Minimal config looks like this:
LoadModule ssl_module modules/mod_ssl.so
Listen 443
<VirtualHost *:443>
# maybe additional config here
ServerName www.example.com
SSLEngine on
SSLCertificateFile "/path/to/www.example.com.cert"
SSLCertificateKeyFile "/path/to/www.example.com.key"
</VirtualHost>
httpd.conf
应该位于/etc/httpd
,/etc/apache/
或类似名称中.
The httpd.conf
should be in /etc/httpd
, /etc/apache/
or similar.
此后重新启动服务器.
有关 Apache服务器SSL 的详细信息.