apache2 以及https認證配置

來源:互聯網
上載者:User

標籤:

環境Ubuntu12.04

 server 配置

  1,首先在進入找到/etc/apache2/apache2.conf的設定檔,裡面有包含了較多設定檔的路徑如:httpd.conf/ports.conf(連接埠配置)/site-enabled/等

 2,在port.conf 配置連接埠(http port=80, https port = 443)

   NameVirtualHost *:80

   Listen 80

      NameVirtualHost *:443

   Listen 443

   3,找到認證以key的配置路徑在/etc/apache2/sites-enabled/default-ssl ,配置以下三處

  SSLCertificateFile            /etc/apache2/ssl/httpd.cert

  SSLCertificateKeyFile      /etc/apache2/ssl/httpd.key

      SSLCertificateChainFile   /etc/apache2/ssl/cacert.pem (這裡cacert.pem和httpd.cert內容完全一樣) 

  產生認證時,配置common name = 本機IP,否則驗證時無法使用,命令如下:

  openssl req -x509 -nodes -newkey ras:2048 -keyout server.key -out server.crt -days 10950

    4,配置完成後,service apache2 restart

 

client使用

  wget -ca--certificate=/certPath/cert -P /dstFilePath https://...IP../srcFile;(若通過http訪問,client將不會驗證認證)

  wget --no-check-certificate  -P /dstFilePath http://...IP../srcFile;

  在client 使用認證時,本機時間一定要比server產生的時間晚。否則會提示認證 not alive.

 

  

apache2 以及https認證配置

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.