wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
certbot-auto certonly --webroot -w /var/lib/tomcat6/webapps -d {DomainName} -m {E-Mail}
cd /etc/letsencrypt/live/{DomainName}
--openssl pkcs12 -export -out bundle.pfx -inkey privkey.pem -in cert.pem -certfile chain.pem -password pass:{PASSWORD}
openssl pkcs12 -export -out /etc/letsencrypt/live/www.vghtc.gov.tw/fullchain_and_key.p12 -in /etc/letsencrypt/live/www.vghtc.gov.tw/fullchain.pem -inkey /etc/letsencrypt/live/www.vghtc.gov.tw/privkey.pem -name tomcat
最後真的有效的
openssl pkcs12 -export -in fullchain.pem -inkey privkey.pem -out keystore.p12 -name tomcat -CAfile chain.pem -caname root //看看能不能上password
keytool -importkeystore -deststorepass cc3fvghtc -destkeypass cc3fvghtc -srckeystore keystore.p12 -destkeystore www.vghtc.gov.tw.jks -srcstoretype pkcs12 -srcstorepass cc3fvghtc -alias tomcat
1202 cp /etc/letsencrypt/live/www.vghtc.gov.tw/www.vghtc.gov.tw.jks /var/lib/tomcat6/
1232 iptables -I PREROUTING -t nat -p tcp --dport 443 -j REDIRECT --to-port 8443
1233 iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
1234 iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 8443 -j ACCEPT
1242 iptables-save
-------------------------------------
強制改走 https
http://adalf0722.blogspot.tw/2010/12/tomcathttp-80https-443.html
0.先備份web.xml與servel.xml
1.編輯Tomcat安裝目錄conf下的web.xml
在</welcome-file-list>與</web-app>之間,加入如下的code,然後存檔
1.編輯Tomcat安裝目錄conf下的web.xml
在</welcome-file-list>與</web-app>之間,加入如下的code,然後存檔
<security-constraint>2.同樣編輯目錄下的server.xml,確認一下redirectPort是不是已經是443
<web-resource-collection>
<web-resource-name>Protected Context</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<Connector port="80" protocol="HTTP/1.1"3.完成,重啟Tomcat一下,就可以試試看囉
connectionTimeout="20000"
redirectPort="443" />
Tomcat Redirect HTTP to HTTPS
In ~TomcatInstallation/conf/server.xmlFor HTTP Connector, set the redirect port to the HTTPS connector port. It will look somewhat like this:<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 --> <Connector port="8090" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" />In ~TomcatInstallation/conf/web.xmlAdd below configuration but make sure to add it after all the servlet mapping tags.<!-- added by Pankaj for automatic redirect from HTTP to HTTPS --> <security-constraint> <web-resource-collection> <web-resource-name>Entire Application</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint>
-------------------------------------
Failed to load keystore type JKS with path jks due to (Permission denied)
把 keystore 搬到 tomcat 家目錄底下(好像在/etc下會看不到 可能是沒有從 root 開始開 read 的關係)
https://teddysun.com/153.html
安装完运行yum报错:
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
解决办法:
编辑[epel]下的baseurl前的#号去掉,mirrorlist前添加#号。正确配置如下:
-------------------------------------
http://acman.bluenest.net/wordpress/archives/96