tomcat 配置https

Tomcat下配置HTTPS 事实上,客户端会生成一个随机秘钥,然后利用该随机秘钥对所要传输的数据进行加密,然后客户端利用自己的公钥对随机秘钥进行加密,然后client将加密后的随机秘钥和数据一起发送给服务器,服务器利用client的证书可以解开随机秘钥,然后再利用随机秘钥解开数据信息。Tomcat核心功能还是作为Java的容器来运行Java后端代码,虽然内置了对HTTP请求的支持,但并不是最优选择,通常部署时,会在Tomcat前面加一个专用的Http服务器,例如Nginx或Apache。客户端对要发送的数据进行加密,发送给服务器。 阅读详情

参考文档

Keytool 使用指南:
 
Tomcat-ssl 配置指南:

配置过程

1.      生成 server key :

以命令行方式切换到目录%TOMCAT_HOME%,在command命令行输入如下命令(jdk1.4以上带的工具): 
keytool -genkey -alias tomcat -keyalg RSA -keypass changeit -storepass changeit -keystore server.keystore -validity 3600
用户名输入域名,如localhost(开发或测试用)或hostname.domainname(用户拥有的域名),其它全部以 enter 跳过,最后确认,此时会在%TOMCAT_HOME%下生成server.keystore 文件。
注:参数 -validity 指证书的有效期(天),缺省有效期很短,只有90天。

2.  将证书导入的JDK的证书信任库中:

这步对于T omcat的SSL配置不是必须,但对于CAS SSO是必须的,否则会出现如下错误:edu.yale.its.tp.cas.client.CASAuthenticationException: Unable to validate ProxyTicketValidator。。。
导入过程分2步,第一步是导出证书,第二步是导入到证书信任库,命令如下:
keytool -export -trustcacerts -alias tomcat -file server.cer -keystore  server.keystore -storepass changeit
keytool -import -trustcacerts -alias tomcat -file server.cer -keystore  %JAVA_HOME%/jre/lib/security/cacerts -storepass changeit
如果有提示,输入Y就可以了。
其他有用keytool命令(列出信任证书库中所有已有证书,删除库中某个证书):
keytool -list -v -keystore D:/sdks/jdk1.5.0_11/jre/lib/security/cacerts
keytool -delete -trustcacerts -alias tomcat  -keystore  D:/sdks/jdk1.5.0_11/jre/lib/security/cacerts -storepass changeit

3.  配置TOMCAT :

修改%TOMCAT_HOME%/conf/server.xml,以文字编辑器打开,查找这一行:
xml 代码
  1.   
将之后的那段的注释去掉,并加上 keystorePass及keystoreFile属性。
注意,tomcat不同版本配置是不同的:

Tomcat4.1.34配置:

    
xml 代码
  1.   
  2.    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"  
  3.            port="8443" enableLookups="true" scheme="https" secure="true"  
  4.            acceptCount="100"  
  5.            useURIValidationHack="false" disableUploadTimeout="true"  
  6.            clientAuth="false" sslProtocol="TLS"    
  7.            keystoreFile="server.keystore"    
  8.            keystorePass="changeit"/>  

Tomcat5.5.9配置:
 
xml 代码
  1.   
  2. <Connector port="8443" maxHttpHeaderSize="8192"  
  3.            maxThreads="150" minSpareThreads="25" maxSpareThreads="75"  
  4.            enableLookups="false" disableUploadTimeout="true"  
  5.            acceptCount="100" scheme="https" secure="true"  
  6.            clientAuth="false" sslProtocol="TLS"    
  7.            keystoreFile="server.keystore"    
  8.            keystorePass="changeit"/>  

Tomcat5.5.20配置(此配置同样可用于Tomcat6.0):
 

xml 代码
  1.   
  2. <Connector protocol="org.apache.coyote.http11.Http11Protocol"    
  3.                      port="8443" maxHttpHeaderSize="8192"  
  4.            maxThreads="150" minSpareThreads="25" maxSpareThreads="75"  
  5.            enableLookups="false" disableUploadTimeout="true"  
  6.            acceptCount="100" scheme="https" secure="true"  
  7.            clientAuth="false" sslProtocol="TLS"                   
  8.            keystoreFile="server.keystore"    
  9.            keystorePass="changeit"/>  

Tomcat6.0.10配置:

xml 代码
  1. <Connector protocol="org.apache.coyote.http11.Http11NioProtocol"  
  2.            port="8443" minSpareThreads="5" maxSpareThreads="75"  
  3.            enableLookups="true" disableUploadTimeout="true"    
  4.            acceptCount="100"  maxThreads="200"  
  5.            scheme="https" secure="true" SSLEnabled="true"  
  6.            clientAuth="false" sslProtocol="TLS"  
  7.            keystoreFile="D:/tools/apache-tomcat-6.0.10/server.keystore"    
  8.            keystorePass="changeit"/>  
tomcat6支持3种,请参考以下文档:

验证配置

<connector protocol="org.apache.coyote.http11.Http11NioProtocol"></connector>

Linux下配置tomcat可通过https访问 1、进入tomcat的conf目录下 cd /opt/apache-tomcat-cms/conf/ 2、执行命令生成证书 keytool -genkey -alias tomcat -keyalg RSA -keystore /opt/apache-tomcat-cms/conf/.keystore -validity 3650 参数说明 keytool -genkey 自动使用默认的算法生成公钥和私钥 -alias 给证书取个别名,注意不要出现重复的名字 .. 阅读详情

相关推荐

Tomcat配置HTTPS

摘要:本文详细介绍了在Tomcat 9+服务器上配置HTTPS的完整步骤。首先使用Keytool生成自签名证书并设置密钥库密码;然后修改Tomcat的server.xml文件,添加HTTPS连接器配置,指定端口、密钥库路径和密码;最后重启Tomcat服务并测试HTTPS连接。文中还包含常见问题解决方法,如证书错误、端口冲突等,适用于测试和生产环境。该配置通过SSL/TLS加密确保Web通信安全,遵循标准安全实践。

RulesChen的博客 629

Tomcat SSL配置大全

由于配置CAS的单点登陆系统,需要先配置Tomcat的SSL, 在配置tomcat的SSL过程中,我配置的版本是tomcat5.5.20,参考了很多资料,但发现一直不行,后来我换到了5.5.9,结果非常顺利,我于是换了总共4个主要版本,发现SSL的配置还真有些不同,现在我将这些配置记录下来,供下次参考。 参考文档 Keytool使用指南: http://java.sun.com/j2se/1...

eddie 283

unity之——解决利用Jenkins在Windows环境下打包unity工程中的场景为apk包,打包打不出来的问题。并且介绍Jenkins从安装到环境配置,调用unity代码的过程(填坑)!!!!!

今天第一次接触Jenkins,比较头疼。网上的Jenkins配置环境相关的资料比较散乱,并且在Windows平台下相关的配置更是少之又少。我在这里讲一下从Jenkins安装到构建工程。打包unity工程的apk包的过程。 1.首先去Jenkins官网下载安装就不说了,安装完成之后在浏览器中输入http://localhost:8080(默认访问地址)进入Jenkins web界面。进行账号的注册...

cgy56191948的博客 2020

Tomcat配置https方式访问

1.准备安全证书 获得安全证书有两种方式:一种方式是到权威机构申购CA证书,还有一种方式是创建自我签名的证书。本文以自签名证书为例,使用SUN公司提供的证书制作工具keytool制作自签证书,JDK版本为1.8。首先打开cmd命令行,使用如下命令创建密钥库和密钥条目: keytool -genkeypair -alias www.bo.org -keyalg RSA -keystore d:...

Boone的博客 3万+

新能源充电桩充电枪口标准

建立的标准确保了新能源汽车充电的安全性、兼容性和效率,促进了新能源汽车产业的发展。

网络安全的研究者、新能源行业的追求者 4687

Android11 关于三方应用获取su权限

SELinux,全称Security-Enhanced Linux,是一种基于Linux内核的安全机制。它通过强制访问控制(MAC)来增强Linux系统的安全性,如果不禁用SELinux,完成下面的修改可能会导致设备进入Recovery界面!adb shell getenforce 为Permissive(宽容模式),查看报错日志,发现是客户apk想使用su命令提权,但是没有权限!对于保护系统资源和防止未经授权访问非常有帮助!系统这边做修改,让su权限下放到三方应用.客户的apk运行报错。

sinat_37429535的博客 1901

Tomcat详解(七)——Tomcat使用https配置实战

今天继续给大家介绍Linux运维相关知识,本文主要内容是Tomcat使用https配置实战。 一、tomcat证书配置 二、tomcat支持https配置 三、tomcat强制使用https

永远是少年 2万+

Ragflow技术栈分析及二次开发指南

Ragflow是目前团队化部署大模型+RAG的优质方案,不过其仍不适合直接部署使用,本文将从实际使用的角度,对其进行二次开发

兴趣使然的创作者 1万+

Nginx配置HTTPS,Tomcat把HTTP切换至HTTPS

文章目录前言一、Nginx配置HTTPS1.下载Nginx2.解压安装包并配置SSL3.修改Nginx配置二、Tomcat配置阀门1.引入库2.读入数据总结 前言 最近客户要把http升级成https,有两个方案,一个是改Nginx,一个是改代码。虽然最终选择的是改代码的方案 ̄へ ̄,但是还是在这边记录一下改Nginx和Tomcat的方案吧(〃‘▽’〃) 一、Nginx配置HTTPS 1.下载Nginx     这一步应该下载或安装完的小伙伴可以直接忽略,首先保证环

一个卑微的java开发 2714

使用蒙特卡洛模拟方法在MATLAB中估算居里温度: 一个详细而通俗的指南

居里温度是磁性材料失去磁性的温度。但是,计算机模拟为我们提供了一个在理论和实验之间的桥梁,使我们能够在不进行实际测量的情况下估计这一重要参数。在下一部分,我们将详细介绍蒙特卡洛迭代的核心代码,以及如何使用它来模拟磁性材料中原子的行为。在估算居里温度的上下文中,我们将使用蒙特卡洛方法来模拟磁性材料中的原子或分子的行为。通过使用蒙特卡洛方法,我们可以在MATLAB中估算居里温度,从而为理论研究和实验设计提供有价值的信息。:我们使用的是一个有限的尺寸的网格模型,这可能导致一些大小效应,特别是在接近居里温度时。

qq_38334677的博客 977

音频链路分析

音频链路分析摘要 本文分析了蓝牙音频设备(BES2700)的音频传输链路,主要包括通话和音乐播放两种场景: 通话链路: 下行:蓝牙接收数据→解码→通过Codec输出到扬声器 上行:麦克风采集→Codec处理→蓝牙编码发送 音乐播放链路: 通过A2DP协议接收高质量音频数据 经过解码、EQ调节等音频处理后输出 系统采用多线程消息机制处理音频任务,通过mailbox传递控制消息,由回调函数处理具体音频数据流。不同应用场景使用不同的蓝牙协议栈(HFP/HSP用于通话,A2DP用于媒体)和编码方式(mSBC/SBC

云淡风轻 85

Tomcat配置https

要求: 配置Linux-3为Tomcat服务器,安装目录为/usr/local/tomcat,网站默认首页内容为“111”,使用443端口加密访问;证书路径为/usr/local/tomcat/conf/tomcat.pfx,格式为pfx。 文章目录 一、Tomcat是什么? 二、使用步骤 1.下载tomcat 2.安装tomcat 3.配置jdk环境 4.修改tomcat默认网页 5.启动tomcat 三、配置https 1.生成证书 2.配置server.x

qq_46153140的博客 6324

华为OD机试双机位C卷 - 高矮个子排队 (C++/Py/Java/Js/Go/C)

华为OD机试双机位C卷 高矮个子排队,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解。华为OD机试 - 高矮个子排队。

qq_45776114的博客 2160

Linux上Tomcat配置HTTPS协议

配置jdk环境(自行百度)很简单不陈述 将下载的tomcat放在linux环境解压 配置java环境变量 具体路径根据java安装路径来决定 在tomcat安装目录的bin目录下 执行 sh startup.sh 如果报此错误 说明权限问题不够 解决方法:在bin目录下执行chmod +x *.sh 重新启动即可 7. 如果做好上面四个步骤 tomcat测试连接是否能成功 如果有多个tomcat请参考 https://www.cnblogs.com/kingsonfu/p/9778516.html .

qq_40745994的博客 4090

【MATLAB代码】雷达观测目标跟踪模型|H-infinity Filter(H无穷大滤波)与EKF(扩展卡尔曼滤波)的对比。附完整代码,订阅专栏后可直接查看

对比了经典扩展卡尔曼滤波(EKF)与H∞优化的EKF(H∞-EKF)在目标跟踪中的性能。通过MATLAB仿真实验,结果显示:在存在模型误差和测量噪声的情况下,H∞-EKF相比经典EKF在位置误差上降低

985工科博士毕业,专攻定位、导航和滤波等算法研究。从业10年,主要使用MATLAB 243

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

tomcat下配置https环境

在网上搜了一下,内容不是很完善。现进行整理,做个学习笔记,以备以后使用。 (1)进入到jdk下的bin目录 (2)输入如下指令“keytool -v -genkey -alias tomcat -keyalg RSA -keystore d:/tomcat.keystore” d:/tomcat.keystore是将生成的tomcat.keystore放到d盘根目录下。注意若要放

4万+

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

【Tomcat】Tomcat配置https证书

Tomcat配置https证书 网上搜索出来大多数是通过keytool自已生成证书来完成,这种在工作很少用到(浏览器会报不安全)。以下是通过申请的证书配置过程。因为在配置中遇到了一些坑,记之 1、准备证书与私钥demo.crt demo.key2、合并证书openssl pkcs12 -export -in demo.crt -inkey demo.key -out demo.p12 -n

KIWI的专栏 1825

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

上一篇: js 面向对象练习
下一篇: cas 单点登录
肖恩小羊
博客等级 码龄14年 2粉丝 8原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值