歡迎您光臨本站 註冊首頁

在Ubuntu 13.10 下安裝支持SSL的Apache

←手機掃碼閱讀     火星人 @ 2014-03-12 , reply: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



[火星人 ] 在Ubuntu 13.10 下安裝支持SSL的Apache已經有558次圍觀

http://coctec.com/docs/linux/show-post-64831.html