tomcat https訪問設定
1> 使用jdk工具生成key檔案
keytool -genkey -alias tomcat -keyalg RSA -keypass changeit -storepass changeit -keystore server.keystore -validity 3600
<!-- Define a SSL HTTP/1.1 Connector on port 8443
This connector uses the JSSE configuration, when using APR, the
connector should be using the OpenSSL style configuration
described in the APR documentation -->
<!--
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->
去掉註釋,加入key檔案配置
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="server.keystore"
keystorePass="changeit"/>
儲存後重啟tomcat可通過https://ip:8443/webproject(你的web專案)通過https訪問,以上使用8443埠,若改為443在訪問時可不加埠,因為443是https預設埠
強制https訪問
在tomcat\conf\web.xml中的</welcome-file-list>後面加上以下配置:
<login-config>
<!-- Authorization setting for SSL -->
<auth-method>CLIENT-CERT</auth-method>
<realm-name>Client Cert Users-only Area</realm-name>
</login-config>
<security-constraint>
<!-- Authorization setting for SSL -->
<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>
這樣輸入http://ip:8080/webproject會強制轉到https://ip:8443/webproject
若https埠配置為其它埠了記得把http轉接埠一起改了
www.2cto.com
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="<span style="color:#FF0000;">8443</span>" URIEncoding="UTF-8" />
//在JDK的bin目錄下輸入以下程式碼
[plain] view plaincopyprint?keytool -genkey -alias tomcat -keyalg RSA -keypass changeit -storepass changeit -keystore server.keystore -validity 3600
<!-- Define a SSL HTTP/1.1 Connector on port 8443
This connector uses the JSSE configuration, when using APR, the
connector should be using the OpenSSL style configuration
described in the APR documentation -->
<!--
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->
去掉註釋,加入key檔案配置
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="server.keystore"
keystorePass="changeit"/>
儲存後重啟tomcat可通過https://ip:8443/webproject(你的web專案)通過https訪問,以上使用8443埠,若改為443在訪問時可不加埠,因為443是https預設埠
強制https訪問
在tomcat\conf\web.xml中的</welcome-file-list>後面加上以下配置:
<login-config>
<!-- Authorization setting for SSL -->
<auth-method>CLIENT-CERT</auth-method>
<realm-name>Client Cert Users-only Area</realm-name>
</login-config>
<security-constraint>
<!-- Authorization setting for SSL -->
<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>
這樣輸入http://ip:8080/webproject會強制轉到https://ip:8443/webproject
若https埠配置為其它埠了記得把http轉接埠一起改了
www.2cto.com
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="<span style="color:#FF0000;">8443</span>" URIEncoding="UTF-8" />
相關文章
- tomcat設定http自動跳轉為https訪問TomcatHTTP
- tomcat高訪問設定問題Tomcat
- tomcat8配置https協議訪問TomcatHTTP協議
- Tomcat中設定http跳httpsTomcatHTTP
- Tomcat全域性/區域性https訪問配置方法TomcatHTTP
- linux tomcat 開通443 (用https安全訪問)LinuxTomcatHTTP
- Tomcat https問題TomcatHTTP
- restTemplate訪問httpsRESTHTTP
- Tomcat訪問分析Tomcat
- postgresql如何設定外界訪問SQL
- nginx設定預設訪問頁面Nginx
- win10快速訪問設定教程 win10系統快速訪問設定方法Win10
- Nginx 訪問日誌格式設定Nginx
- NetScreen裡設定控制訪問
- cxf設定代理訪問webservice介面Web
- django的設定 訪問伺服器端地址設定Django伺服器
- nginx 專案配置 https 訪問NginxHTTP
- http 升級為 https 訪問HTTP
- WebSphere配置https協議訪問WebHTTP協議
- nginx配置https協議訪問NginxHTTP協議
- 設定linux 可以訪問外網Linux
- 設定MYSQL允許用IP訪問MySql
- Windows下設定elacticsearch 訪問密碼Windows密碼
- TOMCAT下設定上下文問題,急!!Tomcat
- tomcat JVM 設定TomcatJVM
- tomcat+jsp訪問mysqlTomcatJSMySql
- Tomcat訪問日誌淺析Tomcat
- redis密碼設定、訪問許可權控制等安全設定Redis密碼訪問許可權
- Swift iOS : 訪問 https 伺服器SwiftiOSHTTP伺服器
- Nginx配置VUE專案Https訪問NginxVueHTTP
- 如何用nginx配置https加密訪問?NginxHTTP加密
- HTTPS訪問:weblogic下配置SSLHTTPWeb
- phpmyadmin設定root賬戶外部訪問PHP
- PHPMyAdmin 設定阿里雲rds訪問PHP阿里
- Linux下設定redis訪問密碼LinuxRedis密碼
- emacs設定代理訪問外掛倉庫Mac
- MySql修改root密碼、設定IP訪問MySql密碼
- tomcat資料來源編碼設定問題Tomcat