在Ubuntu 13.10 下安装支持SSL的Apache
创始人
2024-03-01 11:38:22
0

通过这个简短的教程,让我来指导你如何安装支持SSL的Apache。以下是我的试验机的详细说明:

系统信息

root@ubuntu-unixmen:~# ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:b8:b4:87
inet addr:10.1.1.110 Bcast:10.1.1.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:feb8:b487/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1738 errors:0 dropped:0 overruns:0 frame:0
TX packets:69 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:168845 (168.8 KB) TX bytes:9767 (9.7 KB)
root@ubuntu-unixmen:~# cat /etc/issue
Ubuntu 13.10 \n \l

安装apache

运行如下命令:

$ sudo apt-get install apache2 apache2-doc apache2-utils
Reading package lists... Done
Building dependency tree 
Reading state information... Done
The following extra packages will be installed:
apache2-bin apache2-data libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap ssl-cert

apache测试页面

打开浏览器,转到http://你的测试机的IP地址/。你应该会看到类似以下的信息。

创建目录

创建一个名为ssl的目录

$ sudo mkdir /etc/apache2/ssl

创建一个自签名凭证

$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt

Generating a 2048 bit RSA private key.......................................................................................+++....................................+++writing new private key to '/etc/apache2/ssl/apache.key'-----You are about to be asked to enter information that will be incorporatedinto your certificate request.What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter '.', the field will be left blank.-----Country Name (2 letter code) [AU]:

开启Apache SSL模块

运行以下命令开启ssl模块

$ a2enmod ssl
Considering dependency setenvif for ssl:
Module setenvif already enabled
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache_shmcb for ssl:
Enabling module socache_shmcb.
Enabling module ssl

编辑 /etc/apache2/sites-enabled/default-ssl.conf 文件,

ServerAdmin webmaster@localhost
ServerName www.unixmen.com:443

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key

启用Apache缺省的SSL虚拟主机:

$ a2ensite default-ssl
Enabling site default-ssl.
To activate the new configuration, you need to run:
service apache2 reload

重启Apache:

$ sudo service apache2 restart

测试SSL连接

打开浏览器,转到https://你的测试机IP

安装完成,尽情享用!

via: http://www.unixmen.com/install-apache-ssl-ubuntu-13-10/

译者:Luoxcat 校对:Caroline

本文由 LCTT 原创翻译,Linux中国 荣誉推出

相关内容

Ubuntu 开发方 Ca...
3 月 25 日消息, Linux 发行版 Ubuntu 开发方 ...
2026-03-25 18:01:29
Linux 7.0-rc5...
IT之家 3 月 23 日消息,据科技媒体 XDA 昨天报道,Li...
2026-03-24 12:33:28
监管部门发现Linux系统...
当我还是青少年的时候,我被禁止看《花花公子》杂志。我只想读里面的文...
2026-03-18 11:39:28
Unity引擎要原生适配S...
IT之家 3 月 14 日消息,据科技媒体 TechPower U...
2026-03-15 18:52:34
黄仁勋:智能体AI成行业拐...
来源:环球网 【环球网科技综合报道】3月7日消息,据外媒Wccf...
2026-03-07 13:22:58
开发者把Linux装进PS...
IT之家 3 月 7 日消息,开发者 Andy Nguyen 今天...
2026-03-07 11:18:12

热门资讯

2020 年的 GitHub ... 距离 2020 年结束只剩下区区 24 天,我们即将结束魔幻的 2020 ,迎来新的一年,新的一年或...
开源新闻速递:openSUSE... 今日关注openSUSE 项目组的 Dominique Leuenberger 在他的周报中说:“这...
KDE4.11 Beta1 正...   KDE 项目工作组刚刚发布了 KDE Software Compilation 4.11 Bet...
Helix:高级 Linux ... 说到 基于终端的文本编辑器,通常 Vim、Emacs 和 Nano 受到了关注。这并不意味着没有其他...
如何在 Github 上创建一... 学习如何复刻一个仓库,进行更改,并要求维护人员审查并合并它。你知道如何使用 git 了,你有一个 G...
《Apex 英雄》正式可在 S... 《Apex 英雄》现已通过 Steam Deck 验证,这使其成为支持 Linux 的顶级多人游戏之...
使用时间序列数据,用开源工具助... InfluxData 是一个开源的时间序列数据库平台。下面介绍了它是如何被用于边缘应用案例的。收集到...
OpenWrt 21.02 发... OpenWrt 社区宣布了该发行版的最新稳定版本:OpenWrt 21.02。补充一句,OpenWr...
JStock:Linux 上不... 如果你在股票市场做投资,那么你可能非常清楚投资组合管理计划有多重要。管理投资组合的目标是依据你能承受...
硬核观察 #1249 LG 洗... #1 LG 洗衣机每天上传近 4GB 的数据?一个名为 Johnie 的 LG 洗衣机用户发现,他的...