https和server-status配置案例
https和server-status配置案例
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
[root@yinzhengjie ~]# more /etc/pki/tls/openssl.cnf | grep countryName_default
#countryName_default = XX
countryName_default = CN ------>修改国家名字为中国
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# more /etc/pki/tls/openssl.cnf | grep stateOrProvinceName_default
#stateOrProvinceName_default = Default Province
stateOrProvinceName_default = BeiJing ------->修改省份为北京
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# more /etc/pki/tls/openssl.cnf | grep localityName_default
#localityName_default = Default City
localityName_default = Yizhuang Economic Development Zone ----->修改所在区域
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# more /etc/pki/tls/openssl.cnf | grep .organizationName_default
#.organizationName_default = Default Company Ltd
.organizationName_default = Chinese Academy of Medical Sciences ---->修改你所在的单位
[root@yinzhengjie ~]#
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# more /etc/pki/tls/openssl.cnf | grep organizationalUnitName_default
#organizationalUnitName_default = World Wide Web Pty Ltd
organizationalUnitName_default = LinuxOperation ------>修改你担任的职位
[root@yinzhengjie ~]#
[root@yinzhengjie CA]# openssl req -new -x509 -key private/cakey.pem -days -out cacert.pem
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name ( letter code) [CN]:
State or Province Name (full name) [BeiJing]:
Locality Name (eg, city) [Yizhuang Economic Development Zone]:
Organization Name (eg, company) [Chinese Academy of Medical Sciences]:
Organizational Unit Name (eg, section) [LinuxOperation]:
Common Name (eg, your name or your server's hostname) []:ca.yinzhengjie.org.cn
Email Address []:caadmin@yinzhengjie.org.cn
You have new mail in /var/spool/mail/root
[root@yinzhengjie CA]#
[root@yinzhengjie CA]# ls
cacert.pem certs crl newcerts private
[root@yinzhengjie CA]#
[root@yinzhengjie CA]# touch index.txt serial crlnumber
[root@yinzhengjie CA]# echo > serial
[root@yinzhengjie CA]# ls
cacert.pem certs crl crlnumber index.txt newcerts private serial
[root@yinzhengjie CA]#
[root@yinzhengjie ~]# cd /etc/httpd/conf
[root@yinzhengjie conf]#
[root@yinzhengjie conf]# mkdir ssl
[root@yinzhengjie conf]# cd ssl/
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# (umask ;openssl genrsa > http.key) ----生成服务器的私钥
Generating RSA private key, bit long modulus
..........++++++
...++++++
e is (0x10001)
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# ll
total
-rw-------. root root Oct : http.key
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# openssl req -new -key http.key -out httpd.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name ( letter code) [CN]:
State or Province Name (full name) [BeiJing]:
Locality Name (eg, city) [Yizhuang Economic Development Zone]:
Organization Name (eg, company) [Chinese Academy of Medical Sciences]:
Organizational Unit Name (eg, section) [LinuxOperation]:
Common Name (eg, your name or your server's hostname) []:www.yinzhengjie.org.cn
Email Address []:webadmin@yinzhengjie.org.cn Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: ------>此处的密码可以设置为空,直接回车即可。
An optional company name []:
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# ll
total
-rw-r--r--. root root Oct : httpd.csr
-rw-------. root root Oct : http.key
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# openssl ca -in httpd.csr -out httpd.crt ----->进行CA签名生成一个证书。
Using configuration from /etc/pki/tls/openssl.cnf
Check that the request matches the signature
Signature ok
Certificate Details:
Serial Number: (0x2)
Validity
Not Before: Oct :: GMT
Not After : Oct :: GMT
Subject:
countryName = CN
stateOrProvinceName = BeiJing
organizationName = Chinese Academy of Medical Sciences
organizationalUnitName = LinuxOperation
commonName = www.yinzhengjie.org.cn
emailAddress = webadmin@yinzhengjie.org.cn
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
::A0::0C:2C:FB:::9D:E8:D7:1D:B5:::F7:E5::6A
X509v3 Authority Key Identifier:
keyid:3E:ED:2C::AF:F5:::::E7:8F:::0B::4C:ED::4B Certificate is to be certified until Oct :: GMT ( days)
Sign the certificate? [y/n]:y out of certificate requests certified, commit? [y/n]y
Write out database with new entries
Data Base Updated
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# ll
total
-rw-r--r--. root root Oct : httpd.crt
-rw-r--r--. root root Oct : httpd.csr
-rw-------. root root Oct : http.key
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# grep mod_ssl /etc/httpd/conf/httpd.conf ---->查看是否已经安装mod_ssl模块。
# (e.g. :) if mod_ssl is being used, due to the nature of the
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# grep mod_ssl /etc/httpd/conf.d/*.conf ----->去子目录也查一遍;
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# yum -y install mod_ssl ----->安装mod_ssl模块;
[root@yinzhengjie ssl]# rpm -ql mod_ssl ------>查mod_ssl安装的文件;
/etc/httpd/conf.d/ssl.conf
/usr/lib64/httpd/modules/mod_ssl.so
/var/cache/mod_ssl
/var/cache/mod_ssl/scache.dir
/var/cache/mod_ssl/scache.pag
/var/cache/mod_ssl/scache.sem
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# more /etc/httpd/conf.d/ssl.conf | grep DocumentRoot
DocumentRoot "/var/www/html" ---->设置网站的根目录
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# more /etc/httpd/conf.d/ssl.conf | grep ServerName
ServerName www.yinzhengjie.org.cn: ------>设置主机名
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# more /etc/httpd/conf.d/ssl.conf | grep ErrorLog
ErrorLog logs/ssl_error_log ------->定义错误日志路径
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# more /etc/httpd/conf.d/ssl.conf | grep TransferLog
TransferLog logs/ssl_access_log ------->定义访问日志路径,注意,由于https是二进制格式的协议,因此和httpd的主配置文件定义访问日志的指令是不一样的哟
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# more /etc/httpd/conf.d/ssl.conf | grep LogLevel | grep -v ^#
LogLevel warn --------->定义日志级别
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# more /etc/httpd/conf.d/ssl.conf | grep SSLEngine
SSLEngine on --------->将SSL功能开启,启用基于SSL的虚拟主机;
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# more /etc/httpd/conf.d/ssl.conf | grep SSLProtocol
SSLProtocol all -SSLv2 ---------->表示支持所有的SSL协议,处理-SSLv2版本,换句话说它就只剩下-SSLv3以及TLSv1啦。
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# more /etc/httpd/conf.d/ssl.conf | grep SSLCipherSuite
SSLCipherSuite DEFAULT:!EXP:!SSLv2:!DES:!IDEA:!SEED:+3DES ------>指定SSL的加密套件,注意,感叹号(!)表示不支持的算法,加号(+)表示支持加密算法。
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# more /etc/httpd/conf.d/ssl.conf | grep SSLCertificateFile | grep -v ^#
SSLCertificateFile /etc/httpd/conf/ssl/httpd.crt ------>指定WEB服务器端证书
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# more /etc/httpd/conf.d/ssl.conf | grep SSLCertificateKeyFile
SSLCertificateKeyFile /etc/httpd/conf/ssl/http.key ------->指定WEB服务器的私钥
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# httpd -t ---------->检查配置是否正确
httpd: apr_sockaddr_info_get() failed for yinzhengjie
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Syntax OK -------->说明语法配置无误!
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# service httpd restart ------->重启web服务。
Stopping httpd: [ OK ]
Starting httpd: httpd: apr_sockaddr_info_get() failed for yinzhengjie
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[ OK ]
[root@yinzhengjie ssl]#
[root@yinzhengjie ssl]# ss -tnl | grep ------->查看443端口是否正常监听
LISTEN ::: :::*
[root@yinzhengjie ssl]#
[root@yinzhengjie ~]# openssl s_client -connect www.yinzhengjie.org.cn: -CAfile /etc/pki/CA/cacert.pem ------->我们可以基于本地的命令行进行测试。当然也可以在客户端的浏览器测试,只不过需要安装证书。
[root@yinzhengjie ~]#









[root@yinzhengjie certs]# pwd
/etc/pki/tls/certs
[root@yinzhengjie certs]# make yinzhengjie.key
umask ; \
/usr/bin/openssl genrsa -aes128 > yinzhengjie.key
Generating RSA private key, bit long modulus
........................+++
.......................................................................................+++
e is (0x10001)
Enter pass phrase: ------>要求你输入密码,这里是强制你输入密码,不能为空!
Verifying - Enter pass phrase: ------>要求你重复上次输入的密码
[root@yinzhengjie certs]#
[root@yinzhengjie certs]# ll
total
-rw-r--r--. root root Jul ca-bundle.crt
-rw-r--r--. root root Jul ca-bundle.trust.crt
-rwxr-xr-x. root root Oct make-dummy-cert
-rw-r--r--. root root Oct Makefile
-rwxr-xr-x. root root Oct renew-dummy-cert
-rw-------. root root Oct : yinzhengjie.key
[root@yinzhengjie certs]#
[root@yinzhengjie certs]# make yinzhengjie.pem
umask ; \
PEM1=`/bin/mktemp /tmp/openssl.XXXXXX` ; \
PEM2=`/bin/mktemp /tmp/openssl.XXXXXX` ; \
/usr/bin/openssl req -utf8 -newkey rsa: -keyout $PEM1 -nodes -x509 -days -out $PEM2 -set_serial ; \
cat $PEM1 > yinzhengjie.pem ; \
echo "" >> yinzhengjie.pem ; \
cat $PEM2 >> yinzhengjie.pem ; \
rm -f $PEM1 $PEM2
Generating a bit RSA private key
..+++
......................................................................+++
writing new private key to '/tmp/openssl.Ra7W2f'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name ( letter code) [XX]: ------->一路回车即可,我们这里只是测试。
State or Province Name (full name) []:
Locality Name (eg, city) [Default City]:
Organization Name (eg, company) [Default Company Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:
Email Address []:
You have new mail in /var/spool/mail/root
[root@yinzhengjie certs]#
具体的配置参数可参考:
<Location /server-status>
SetHandler server-status
AuthType Basic
AuthName "Sever Status"
AuthUserFile /etc/httpd/conf/.ApachePassword
Require valid-user
Order deny,allow
Allow from all
</Location>

https和server-status配置案例的更多相关文章
- tomcat支持https的server.xml配置
访问地址:https://127.0.0.1/testWeb/mySevlet?url=123&action=aaa server.xml: <?xml version='1.0' en ...
- Httpd服务入门知识-Httpd服务常见配置案例之Apache的工作做状态status页面
Httpd服务入门知识-Httpd服务常见配置案例之Apache的工作做状态status页面 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.status功能概述 status页 ...
- Httpd服务入门知识-Httpd服务常见配置案例之定义'Main' server的文档页面路径(文档根路径)
Httpd服务入门知识-Httpd服务常见配置案例之定义'Main' server的文档页面路径(文档根路径) 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.创建测试文件 [ ...
- 使用mysql存放Ambari元数据的配置案例
使用mysql存放Ambari元数据的配置案例 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.环境准备 详情请参考我之前的笔记:离线方式部署Ambari2.6.0.0 中关 ...
- Nginx插件之openresty反向代理和日志滚动配置案例
Nginx插件之openresty反向代理和日志滚动配置案例 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.openresty介绍 1>.Nginx介绍 Nginx是一款 ...
- springboot配置server相关配置&整合模板引擎Freemarker、thymeleaf&thymeleaf基本用法&thymeleaf 获取项目路径 contextPath 与取session中信息
1.Springboot配置server相关配置(包括默认tomcat的相关配置) 下面的配置也都是模板,需要的时候在application.properties配置即可 ############## ...
- Tomcat7/8访问Server Status、Manager App、Host Manager出现403 forbidden
在配置好Tomcat7/8后,我们往往需要访问Tomcat7/8的Manager以及Host Manager.就需要在tomcat-users.xml中配置用户角色来实现.在地址栏输入:localho ...
- CISCO ASA 5505 经典配置案例
nterface Vlan2 nameif outside ----------------------------------------对端口命名外端口 security-level 0 -- ...
- tomcat如何登录Server Status、Manager App、Host Manager
启动tomcat后,访问127.0.0.1会进入如下页面 版权声明:本文为博主原创文章,未经博主允许不得转载. 原文地址:https://www.cnblogs.com/poterliu/p/9602 ...
随机推荐
- 20135337——Linux实践二:模块
一.编译&生成&测试&删除 1.编写模块代码,查看如下 gedit 1.c(编写) cat 1.c(查看) MODULE_AUTHOR("Z") MODUL ...
- <<梦断代码>>阅读笔记三
看完了这最后三分之一的<梦断代码>,意味着这本软件行业的著作已经被我粗略地过了一遍. 在这最后三分之一的内容中,我深入了解了在大型软件项目的运作过程中存在的困难和艰辛.一个大型软件项目的成 ...
- Microsoft Orleans构建高并发、分布式的大型应用程序框架
Microsoft Orleans 在.net用简单方法构建高并发.分布式的大型应用程序框架. 原文:http://dotnet.github.io/orleans/ 在线文档:http://dotn ...
- 开源通用爬虫框架YayCrawler-开篇
各位好!从今天起,我将用几个篇幅的文字向大家介绍一下我的一个开源作品--YayCrawler,其在GitHub上的网址是:https://github.com/liushuishang/YayCraw ...
- PAT L2-002 链表去重
https://pintia.cn/problem-sets/994805046380707840/problems/994805072641245184 给定一个带整数键值的链表 L,你需要把其中绝 ...
- 在Windows下查看Java的JRE路径
java -showversionecho %JAVA_HOME%path 这个方法可以确认当前java.exe的版本,但是并不能确定输出JRE的具体路径. JAVA_HOME的路径,也不一定就是当前 ...
- TMainMenu - 隐藏与显示菜单
//隐藏与显示菜单 Self.Menu := nil; {隐藏菜单} Self.Menu := MainMenu1; {显示菜单}
- 黑客又多一款喜爱工具:知名 Windows Phone 破解工具 WPinternals 开源了
导读 Windows Phone 发布后,黑客 HeathCliff74(René Lergner)写了一个软件 WPinternals,利用它可以对 Windows Phone 进行破解,这使他成为 ...
- 【题解】Hanoi双塔问题
题目描述 给定A,B,C三根足够长的细柱,在A柱上放有2n个中间有空的圆盘,共有n个不同的尺寸,每个尺寸都有两个相同的圆盘,注意这两个圆盘是不加区分的(下图为n=3的情形).现要将这些圆盘移到C柱上, ...
- LOJ116 有源汇有上下界最大流(上下界网络流)
考虑有源汇上下界可行流:由汇向源连inf边,那么变成无源汇图,按上题做法跑出可行流.此时该inf边的流量即为原图中该可行流的流量.因为可以假装把加上去的那些边的流量放回原图. 此时再从原来的源向原来的 ...