https(全稱(chēng):Hyper Text Transfer Protocol over Secure Socket Layer)咕村,是以安全為目標(biāo)的 http 通道隆圆,簡(jiǎn)單講是 http 的安全版姿现。即 http 下加入 SSL 層奋献,https 的安全基礎(chǔ)是 SSL,因此加密的詳細(xì)內(nèi)容就需要 SSL荸恕。
這些天研究小程序的時(shí)候發(fā)現(xiàn)小程序的接口一定要是https的域名才有用角寸,當(dāng)然本地測(cè)試的時(shí)候菩混,開(kāi)發(fā)者工具里不要登陸的自己的微信賬號(hào),http訪問(wèn)還是有用的扁藕;https在寫(xiě)接口的時(shí)候還是挺重要的沮峡,像post參數(shù)在http訪問(wèn)中雖然存在body里表面是是看不到了,其實(shí)用抓包工具一抓就能拿到亿柑,而https就就進(jìn)行了加密邢疙,就算拿到了,也是一串加密過(guò)的字符望薄。https可以保證傳輸數(shù)據(jù)的安全疟游。
上面只是我對(duì)https一些粗淺的理解,以后有了新的理解再補(bǔ)充痕支。
在搭建LAMP環(huán)境(linux+apache+mysql+php)的時(shí)候颁虐,自己走了不少?gòu)澛罚碼pache的config文件看到想吐卧须,可是配置出來(lái)還是不盡人意另绩。在初始化了一次服務(wù)器之后,我實(shí)在是不想重新一步一步重新配置環(huán)境花嘶,于是去找了一鍵搭建的腳本笋籽,發(fā)現(xiàn)了(lamp這是大神打包好的腳本)https://github.com/teddysun,感動(dòng)到想哭察绷。
準(zhǔn)備工作:
- 阿里云服務(wù)器1臺(tái)(裝成centos7.2)
- xshell 遠(yuǎn)程連接工具
yum -y install wget screen git
git clone https://github.com/teddysun/lamp.git
cd lamp
chmod +x *.sh
screen -S lamp
./lamp.sh
一行一行執(zhí)行干签!
這樣津辩,lamp環(huán)境就搭建好了拆撼,打開(kāi)服務(wù)器80端口容劳,就可以使用瀏覽器訪問(wèn)你的服務(wù)器IP地址了,顯示一個(gè)lamp的網(wǎng)頁(yè)”即說(shuō)明lamp環(huán)境配置成功闸度,網(wǎng)頁(yè)文件存放根目錄:/data/www/default
安裝完畢之后用lamp命令
lamp add
交互顯示如下:
Please enter server names(example: www.lamp.sh lamp.sh): 此處輸入網(wǎng)站域名
Please enter website root directory(default:/data/www/網(wǎng)站域名): 此處輸入網(wǎng)站根目錄路徑竭贩,默認(rèn)回車(chē)即可
Please enter Administrator Email address: 此處輸入管理員郵箱地址
Administrator Email address: 此處顯示上一步輸入的郵箱地址
Do you want to create a database and mysql user with same name? [y/n]: 此處輸入 y 或 n,表示創(chuàng)建或不創(chuàng)建數(shù)據(jù)庫(kù)(輸入 y)
Virtual host [網(wǎng)站域名] has been created
Website root directory is: /data/www/網(wǎng)站域名
Database [數(shù)據(jù)庫(kù)名] and mysql user [數(shù)據(jù)庫(kù)用戶名] has been created // 數(shù)據(jù)庫(kù)及同名用戶創(chuàng)建成功
Reloading the apache config file...
Syntax OK
Reload success
Do you want to add a SSL certificate? [y/n]: 此處輸入 y 或 n莺禁,表示添加或不添加證書(shū)(輸入 y)
1: Use your own SSL Certificate and Key
2: Use Let's Encrypt to create SSL Certificate and Key
Please enter 1 or 2: 此處輸入 1 或 2留量,表示使用自己的證書(shū),或使用 Let's Encrypt 簽發(fā)免費(fèi)證書(shū)(輸入 2)
You have already chosen Let's Encrypt
It will be processed automatically
Installing certbot command...
此處開(kāi)始下載安裝 certbot 命令
Starting create Let's Encrypt SSL Certificate...
此處開(kāi)始安裝 certbot 運(yùn)行所需的依賴庫(kù)等
Creating virtual environment...
Installing Python packages...
Installation succeeded.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for 網(wǎng)站域名
Using the webroot path /data/www/網(wǎng)站域名 for all unmatched domains.
Waiting for verification...
Cleaning up challenges
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/網(wǎng)站域名/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/網(wǎng)站域名/privkey.pem
Your cert will expire on 2018-02-02. To obtain a new or tweaked
version of this certificate in the future, simply run certbot
again. To non-interactively renew *all* of your certificates, run
"certbot renew"
- Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
Let's encrypt crontab renew rule is not exist, create it!
Create Let's Encrypt SSL Certificate successfully
Reloading the apache config file...
Syntax OK
Reload success
All done
輸入2哟冬,自動(dòng)安裝一個(gè) Let's Encrypt 簽發(fā)的免費(fèi)證書(shū)
按提示下一步就ok楼熄,安裝完畢后,已經(jīng)自動(dòng)幫我們的http重定向到https浩峡,之后訪問(wèn)我們自己的域名可岂,都是自動(dòng)調(diào)整到https://
簡(jiǎn)單到想流淚啊,省了不少時(shí)間翰灾,感謝大佬缕粹!有疑問(wèn)可以評(píng)論回復(fù)!