WampServer啟用https

來源:互聯網
上載者:User
產生CA私密金鑰和CA自我簽署憑證:
genrsa -aes128 -out ca/cakey.pem 2048
req -new -x509 -key ca/cakey.pem -out ca/ca.crt -outform PEM -config ./openssl.cnf
{
Country Name (2 letter code) [AU]:CN
State or Province Name (full name) [Some-State]:Shanghai
Locality Name (eg, city) []:Shanghai
Organization Name (eg, company) [Internet Widgits Pty Ltd]:companyX
Organizational Unit Name (eg, section) []:sectionX
Common Name (e.g. server FQDN or YOUR name) []:MyCA
Email Address []:a@b.com
}

產生伺服器私密金鑰和認證請求:
genrsa -aes128 -out server/serverkey.pem 2048
(
win32下不支援加密秘鑰,
1、解密:rsa -in server/serverkey.pem -out server/server_noencrypt.pem
)

req -new -key server/serverkey.pem -out server/server.csr -outform PEM -config ./openssl.cnf
{
Country Name (2 letter code) [AU]:CN
State or Province Name (full name) [Some-State]:Shanghai
Locality Name (eg, city) []:Shanghai
Organization Name (eg, company) [Internet Widgits Pty Ltd]:companyX
Organizational Unit Name (eg, section) []:sectionX
Common Name (e.g. server FQDN or YOUR name) []:127.0.0.1
Email Address []:a@b.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
}

用ca認證簽名伺服器/用戶端認證:
ca -in server/server.csr -out server/server.crt -cert ca/ca.crt -keyfile ca/cakey.pem -config ./openssl.cnf
==========================================================
修改httpd.conf:
#LoadModule ssl_module modules/mod_ssl.so
#Include conf/extra/httpd-mpm.conf
去掉前邊的#號
修改httpd-ssl.conf:
SSLCertificateFile    xxx/conf/key/server.crt    (伺服器憑證的位置) 
SSLCertificateKeyFile    xxx/conf/key/server.key (伺服器私密金鑰的位置) 
SSLCACertificateFile    xxx/key/conf/ca.crt      (CA根憑證的位置,進行用戶端驗證時需要)
#SSLVerifyClient require               (去掉前面的‘#’號,進行用戶端驗證時需要) 
#SSLVerifyDepth  1                     (去掉前面的‘#’號,把10改為1,進行用戶端驗證時需要)
==========================================================
遇到錯誤:
【假如遇到apache無法啟動的時候,可以選我的電腦-》管理-》事件檢查器-》應用程式記錄檔,開啟apache的錯誤報表,會有提示哪裡出錯了,一般都可以找到原因。】

【Apache2.4配置SSL後啟動報錯:AH02577: Init: SSLPassPhraseDialog builtin is not supported on Win32 (key file C:/Apache24/conf/server.key)
原因是因為Win32平台不支援加密金鑰,啟動Apache時就產生了上述錯誤;
問題解決思路:既然不支援加密,就把server.key的檔案解密(同時注釋掉httpd-ssl.conf檔案中SSLPassPhraseDialog)
解密:openssl rsa -in server.key.org -out server.key
開啟httpd-ssl.conf 找到SSLPassPhraseDialog  builtin 在前面加上#】


1、Windows平台 
在windows命令列視窗下執行: 
1.查看所有的連接埠佔用情況
C:\>netstat -ano
  協議    本地地址                     外部地址               狀態                   PID
  TCP    127.0.0.1:1434         0.0.0.0:0              LISTENING       3236

2.查看指定連接埠的佔用情況
C:\>netstat -aon|findstr "9050"
  協議    本地地址                     外部地址               狀態                   PID
  TCP    127.0.0.1:9050         0.0.0.0:0              LISTENING       2016

3.查看PID對應的進程
C:\>tasklist|findstr "2016"
 映像名稱                       PID 會話名              會話#       記憶體使用量
 ========================= ======== ================
  tor.exe                     2016 Console                 0     16,064 K 

4.結束該進程
C:\>taskkill /f /t /im tor.exe

聯繫我們

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