騰訊雲CentOS Apache開啟HTTPS


1.申請SSL證書

https://console.qcloud.com/ssl?utm_source=yingyongbao&utm_medium=ssl&utm_campaign=qcloud

 

2.配置Linux服務器

首先安裝openssl

# yum install mod_ssl openssl

然后將我們第一步生成的SSL上傳到服務器

# cp www.bincoding.cn.crt /etc/pki/tls/certs/
# cp www.bincoding.cn.key /etc/pki/tls/private/

進入/etc/pki/tls/private/目錄:生成csr文件

openssl req -new -key www.bincoding.cn.key -out www.bincoding.cn.csr 

中間需要輸入證書信息

[root@VM_238_215_centos private]# openssl req -new -key www.bincoding.cn.key -out www.bincoding.cn.csr 
You are about to be asked to enter information that will be incorporated
into 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 blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:ChongQing
Locality Name (eg, city) [Default City]:ChongQing
Organization Name (eg, company) [Default Company Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:
Email Address []:

 

3.配置Apache 服務器

# vim /etc/httpd/conf.d/ssl.conf
### overwrite the following parameters ###
SSLCertificateFile /etc/pki/tls/certs/www.bincoding.cn.crt
SSLCertificateKeyFile /etc/pki/tls/private/www.bincoding.cn.key

### The following parameter does not need to be modified in case of a self-signed certificate. ###
### If you are using a real certificate, you may receive a certificate bundle. The bundle is added using the following parameters ###
SSLCertificateChainFile /etc/pki/tls/certs/example.com.ca-bundle

然后重啟httpd

# service httpd restart

 

重啟成功后apache已經支持https了~


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM