apache24 https配置步驟

2021-09-25 02:04:22 字數 2092 閱讀 9267

1、  確認是否安裝ssl模組

是否有mod_ssl.so檔案

2、  生成證書和金鑰

linux下

步驟1:生成金鑰

命令:openssl genrsa 1024 -out server.key (生成乙個私鑰)

說明:這是用128位rsa演算法生成金鑰,得到server.key檔案

步驟2: 生成證書請求檔案

命令:openssl req -new -key server.key -out server.csr(根據私鑰生成公鑰)

說明:這是用步驟1的金鑰生成證書請求檔案server.csr, 這一步提很多問題,一一輸入

步驟3: 生成證書

命令:openssl req -x509 -days 365 -key server.key -in server.csr -out server.crt(用私鑰對公鑰進行簽名認證,防止冒充)

說明:這是用步驟1,2的的金鑰和證書請求生成證書server.crt,-days引數指明證書有效期,單位為天

window下

步驟1:生成金鑰

命令:openssl genrsa 1024 > server.key

說明:這是用128位rsa演算法生成金鑰,得到server.key檔案

步驟2: 生成證書請求檔案

命令:openssl req -config d:\work_soft\apache2.2\conf\openssl.cnf -new -key server.key > server.csr

說明:這是用步驟1的金鑰生成證書請求檔案server.csr, 這一步提很多問題,一一輸入

(裡面有一步common name 輸入網域名稱:servername localhost:443,其他的輸入直接回車即可)

步驟3: 生成證書

命令:openssl req -config d:\work_soft\apache2.2\conf\openssl.cnf -x509 -days 365 -key server.key -in server.csr > server.crt

說明:這是用步驟1,2的的金鑰和證書請求生成證書server.crt,-days引數指明證書有效期,單位為天

把得到的server.key和server.crt檔案拷貝到apache的對應目錄

(把server.key server.csr(根據字串構建) server.crt(根據字串構建)拷貝到c:\apache24\conf目錄下)

openssl dhparam -check -text -5 512 -out dh512.pem中(boost庫實現ssl套接字時需要生成的金鑰交換檔案)

3、  配置apache

l  修改httpd-ssl.conf檔案

注意在此檔案中配置證書和金鑰

sslcertificatefile /apache/conf/server.crt

sslcertificatekeyfile /apache/conf/server.key 

documentroot ""

servername localhost:443(埠號不能變,否則瀏覽器裡面必須帶埠號)

虛擬機器設定

namevirtualhost *:443

l  修改httpd.conf檔案

步驟1:開啟ssl模組

(windows上還需要放開:loadmodule socache_shmcb_module modules/mod_socache_shmcb.so)

(還有:servername localhost:80)

步驟2:引入ssl配置檔案

步驟3:如果你配置的虛擬機器,注意一下埠的訪問接受情況

namevirtualhost *:80

4、  重新啟動apache

用https方式訪問,檢視是否生效

5.測試是否成功

https://localhost(沒有繳費的證書,谷歌視為不安全,點高階,進去能夠開啟預設頁面就成功了)

apache 配置https訪問

最近搞facebook小遊戲,h5通過ajax訪問伺服器端的時候發現 需要用https安全鏈結訪問,不然,直接拒絕。接下來寫一下怎麼配置https網域名稱 1 首先,你得有乙個https證書繫結的網域名稱 比如 www.test.com 這個東西很多地方都能申請啦,有免費的,有收費的,不多贅述。2 ...

apache如何配置https

一 找到 apache 的配置檔案 首先確認您的 apache 安裝目錄所在位置,開啟該安裝目錄下的 conf 目錄,並在 conf 目錄下找到 httpd.conf 檔案以及 extra 目錄下的 httpd ssl.conf 檔案,這兩個檔案就是稍後所需要修改的 apache 的配置檔案,您可以...

Apache 配置 HTTPS訪問

將需要配置的專案移動到另一根目錄下,作為https訪問位置。修改bitnami配置檔案.bitnami wampstack 5.6.19 0 apache2 conf bitnami bitnami.conf。修改443埠下的配置 documentroot 和 directory的內容為專案的htt...