二级域名,https协议的申请配置
1.?申請(qǐng)二級(jí)域名:
?????????????登錄阿里賬號(hào),點(diǎn)擊域名,解析域名,添加解析,加入前綴,ip
即可
?
2.?申請(qǐng)ca認(rèn)證書(shū)(實(shí)現(xiàn)安全協(xié)議https訪問(wèn)):
??????????????登錄阿里云賬號(hào) ?,點(diǎn)擊ca認(rèn)證申請(qǐng) ,購(gòu)買,選擇免費(fèi),提交申請(qǐng)(選系統(tǒng)生成),申請(qǐng)完成后進(jìn)行下載。然后進(jìn)行配置即可
在tomcat的目錄下創(chuàng)建一個(gè)cert文件夾,將下載的證書(shū)放置在下面
?
Tomcat未添加https的證書(shū)配置報(bào)錯(cuò):
Error parsing HTTP request header
?Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens
?
?解除該配置
<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
???????????????maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
???????????????clientAuth="false" sslProtocol="TLS"
???????????????keystoreFile="cert/214683529790027.pfx"
???keystoreType="PKCS12"
???keystorePass="214683529790027"
???/>
?
?
配置即可? ? ?tomcat需要配置原鏈接www.baidu.com跳轉(zhuǎn)到https://www.baidu.com的方法
在conf/web.xml中最后一行添加:
②在web.xml末尾加上如下配置:
<security-constraint>
? ? <web-resource-collection >
? ? ? ? ? ? ? <web-resource-name >SSL</web-resource-name>
? ? ? ? ? ? ? <url-pattern>/*</url-pattern>
? ? ? ?</web-resource-collection>
? ? ? ?<user-data-constraint>
? ? ? ?<transport-guarantee>CONFIDENTIAL</transport-guarantee>
? ? ? ?</user-data-constraint>
</security-constraint>
?
nginx的配置為:
server {
listen 80;
server_name ?www.opennet.com.cn;
location ?/{
?rewrite ^(.*) https://$server_name$1 permanent;
}
?
?
}
?
server {
????listen 443;
????server_name www.opennet.com.cn;
????ssl on;
????root D:/opennet_website2;
????index index.html index.htm;
????ssl_certificate ??cert/1529411679067.pem;
????ssl_certificate_key ?cert/1529411679067.key;
????ssl_session_timeout 5m;
????ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
????ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
????ssl_prefer_server_ciphers on;
????location / {
????????root D:/opennet_website2;
????????index index.html index.htm;
????}
}
?
?
?
總結(jié)
以上是生活随笔為你收集整理的二级域名,https协议的申请配置的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 实习收获—Java后台开发
- 下一篇: 写给想加入淘宝的在校同学--广州实习生招