apache配置https串連

來源:互聯網
上載者:User

以下例子在mac os下測試通過。其他環境雷同:

1.開啟 /etc/apache2/httpd.conf  取消掉Include /private/etc/apache2/extra/httpd-ssl.conf 前面的注釋符號#

2產生KEY和認證。 因為在 /private/etc/apache2/extra/httpd-ssl.conf 已經配置好KEY 和認證的名字所以下面的步驟中請不要修改產生的KEY檔案的名字 如果修改請把httpd-ssl.conf中相應的檔案路徑和名字也修改

cd /etc/apache2

openssl genrsa -des3 -out server.key 1024

enter a passphrase for your private key. (輸入key 的密碼在接下來的過程中會用到,如果是為來開發用建議使用簡單的比如 123456)

openssl req -new -key server.key -out server.csr

(接下來會提示輸入一些比如國家了 省市了 名字 郵箱那些 隨便輸入就可以了)

openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

cp server.key server.key.copy

openssl rsa -in server.key.copy -out server.key

(以上兩個紅色字的步驟理論上是不需要的 但是在我測試的過程中是必須的。 如果不要啟動Apache 的時候會提示輸入KEY 的密碼 但是我這裡不提示。 所以建議還是執行以上步驟)

sudo //etc/apache2/apachectl restart

https://localhost/  這樣就可以訪問了 如果用 https://localhos:443 會被自動跳轉到 https://localhost

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.