热门标签 | HotTags
当前位置:  开发笔记 > 前端 > 正文

Centos5下配置https服务器的方法

Centos5下配置https服务器的步骤,需要的朋友可以参考下。
[root@centos5 ~]# yum -y install mod_ssl 在线安装mod_ssl
Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
* base: centos.candishosting.com.cn
* updates: mirror.khlug.org
* addons: centos.candishosting.com.cn
* extras: centos.candishosting.com.cn
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package mod_ssl.i386 1:2.2.3-11.el5_2.centos.4 set to be updated
--> Processing Dependency: libdistcache.so.1 for package: mod_ssl
--> Processing Dependency: libnal.so.1 for package: mod_ssl
--> Running transaction check
---> Package distcache.i386 0:1.4.5-14.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
mod_ssl i386 1:2.2.3-11.el5_2.centos.4 updates

85 k
Installing for dependencies:
distcache i386 1.4.5-14.1 base 119 k

Transaction Summary
=============================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 204 k
Downloading Packages:
(1/2): mod_ssl-2.2.3-11.e 100% |=========================| 85 kB 00:02
(2/2): distcache-1.4.5-14 100% |=========================| 119 kB 00:03
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: distcache ######################### [1/2]
Installing: mod_ssl ######################### [2/2]

Installed: mod_ssl.i386 1:2.2.3-11.el5_2.centos.4
Dependency Installed: distcache.i386 0:1.4.5-14.1
Complete!

[root@centos5 ~]# cd /etc/httpd/conf 进入HTTP服务器配置文件所在目录
[root@centos5 conf]# rm -rf ssl.*/server.* 删除默认或残留的服务器证书相关文件

[root@centos5 ~]# rpm -qa |grep openssl
openssl-0.9.8b-10.el5

[root@centos5 ~]# openssl genrsa -out www.yang.com.key 1024 建立服务器密钥
Generating RSA private key, 1024 bit long modulus
...........................................................++++++
.++++++
e is 65537 (0x10001)

[root@centos5 ~]# openssl req -new -key www.yang.com.key -out www.yang.com.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 (2 letter code) [GB]:OM 输入国名
State or Province Name (full name) [Berkshire]:fuzhou 输入省名
Locality Name (eg, city) [Newbury]:fou 输入城市名
Organization Name (eg, company) [My Company Ltd]:yang 输入组织名(任意)
Organizational Unit Name (eg, section) []:www 不输入,直接回车
Common Name (eg, your name or your server's hostname) []:www.yang.com 输入通称(任意)
Email Address []:admin@yang.com 输入电子邮箱地址

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: 不输入,直接回车
An optional company name []: 不输入,直接回车

[root@centos5 ~]# ls -l
total 68
-rw------- 1 root root 986 Jan 31 23:54 anaconda-ks.cfg
drwxr-xr-x 2 root root 4096 Feb 1 02:17 Desktop
-rw-r--r-- 1 root root 0 Feb 1 03:06 Finished
-rw-r--r-- 1 root root 15078 Jan 31 23:54 install.log
-rw-r--r-- 1 root root 2876 Jan 31 23:53 install.log.syslog
-rw-r--r-- 1 root root 0 Feb 1 03:06 Package
-rw-r--r-- 1 root root 0 Feb 1 03:06 Processing
-rw-r--r-- 1 root root 0 Feb 1 03:06 Running
-rw-r--r-- 1 root root 684 Feb 1 04:54 www.yang.com.csr
-rw-r--r-- 1 root root 887 Feb 1 04:52 www.yang.com.key

[root@centos5 ~]# openssl x509 -req -days 365 -in www.yang.com.csr -signkey www.yang.com.key -out www.yang.com.crt 建立服务器证书

Signature ok
subject=/C=OM/ST=fuzhou /L=fou/O=yang/OU=www/CN=www.yang.com/emailAddress=admin@ yang.com
Getting Private key

[root@centos5 ~]# ll
total 72
-rw------- 1 root root 986 Jan 31 23:54 anaconda-ks.cfg
drwxr-xr-x 2 root root 4096 Feb 1 02:17 Desktop
-rw-r--r-- 1 root root 0 Feb 1 03:06 Finished
-rw-r--r-- 1 root root 15078 Jan 31 23:54 install.log
-rw-r--r-- 1 root root 2876 Jan 31 23:53 install.log.syslog
-rw-r--r-- 1 root root 0 Feb 1 03:06 Package
-rw-r--r-- 1 root root 0 Feb 1 03:06 Processing
-rw-r--r-- 1 root root 0 Feb 1 03:06 Running
-rw-r--r-- 1 root root 920 Feb 1 04:57 www.yang.com.crt
-rw-r--r-- 1 root root 684 Feb 1 04:54 www.yang.com.csr
-rw-r--r-- 1 root root 887 Feb 1 04:52 www.yang.com.key


[root@centos5 ~]# vi /etc/httpd/conf.d/ssl.conf 修改SSL的设置文件

# When we also provide SSL we have to listen to the
# the HTTPS port in addition.
#
Listen 443

[root@centos5 ~]# /etc/rc.d/init.d/httpd restart 重启服务
Stopping httpd: [ OK ]
Starting httpd: [ OK ]

[root@centos5 ~]# netstat -ntpl |grep 443
tcp 0 0 :::443 :::* LIST

EN 10317/httpd



注:本实验以http://www.centospub.com/make/ssl.html为指导

配置SSL虚拟主机

#vi /etc/httpd/conf/httpd.conf

NameVirtualHost 192.168.0.20:443

NameVirtualHost 192.168.0.20:80

ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/html
ServerName www. yang.com

SSLEngine on
SSLCertificateFile /etc/httpd/conf/www.yang.com.crt
SSLCertificateKeyFile /etc/httpd/conf/www.yang.com.key

ErrorLog logs/dummy-www.yang.com-error_log
CustomLog logs/dummy-www.yang.com-access_log common


ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/cgi-bin/openwebmail
ServerName mail.yang.com

SSLEngine on
SSLCertificateFile /etc/httpd/conf/www.yang.com.crt
SSLCertificateKeyFile /etc/httpd/conf/www.yang.com.key

ErrorLog logs/dummy-www.yang.com-error_log
CustomLog logs/dummy-www.yang.com-access_log common



#vi /etc/httpd/conf.d/ssl.conf 添加下面的内容

SSLEngine on
SSLCertificateFile /etc/httpd/conf/www.yang.com.crt
SSLCertificateKeyFile /etc/httpd/conf/www.yang.com.key


推荐阅读
  • Nginx使用AWStats日志分析的步骤及注意事项
    本文介绍了在Centos7操作系统上使用Nginx和AWStats进行日志分析的步骤和注意事项。通过AWStats可以统计网站的访问量、IP地址、操作系统、浏览器等信息,并提供精确到每月、每日、每小时的数据。在部署AWStats之前需要确认服务器上已经安装了Perl环境,并进行DNS解析。 ... [详细]
  • 本文介绍了在开发Android新闻App时,搭建本地服务器的步骤。通过使用XAMPP软件,可以一键式搭建起开发环境,包括Apache、MySQL、PHP、PERL。在本地服务器上新建数据库和表,并设置相应的属性。最后,给出了创建new表的SQL语句。这个教程适合初学者参考。 ... [详细]
  • 这是原文链接:sendingformdata许多情况下,我们使用表单发送数据到服务器。服务器处理数据并返回响应给用户。这看起来很简单,但是 ... [详细]
  • Centos7.6安装Gitlab教程及注意事项
    本文介绍了在Centos7.6系统下安装Gitlab的详细教程,并提供了一些注意事项。教程包括查看系统版本、安装必要的软件包、配置防火墙等步骤。同时,还强调了使用阿里云服务器时的特殊配置需求,以及建议至少4GB的可用RAM来运行GitLab。 ... [详细]
  • 禁止程序接收鼠标事件的工具_VNC Viewer for Mac(远程桌面工具)免费版
    VNCViewerforMac是一款运行在Mac平台上的远程桌面工具,vncviewermac版可以帮助您使用Mac的键盘和鼠标来控制远程计算机,操作简 ... [详细]
  • 本文介绍了计算机网络的定义和通信流程,包括客户端编译文件、二进制转换、三层路由设备等。同时,还介绍了计算机网络中常用的关键词,如MAC地址和IP地址。 ... [详细]
  • 如何在服务器主机上实现文件共享的方法和工具
    本文介绍了在服务器主机上实现文件共享的方法和工具,包括Linux主机和Windows主机的文件传输方式,Web运维和FTP/SFTP客户端运维两种方式,以及使用WinSCP工具将文件上传至Linux云服务器的操作方法。此外,还介绍了在迁移过程中需要安装迁移Agent并输入目的端服务器所在华为云的AK/SK,以及主机迁移服务会收集的源端服务器信息。 ... [详细]
  • 阿里Treebased Deep Match(TDM) 学习笔记及技术发展回顾
    本文介绍了阿里Treebased Deep Match(TDM)的学习笔记,同时回顾了工业界技术发展的几代演进。从基于统计的启发式规则方法到基于内积模型的向量检索方法,再到引入复杂深度学习模型的下一代匹配技术。文章详细解释了基于统计的启发式规则方法和基于内积模型的向量检索方法的原理和应用,并介绍了TDM的背景和优势。最后,文章提到了向量距离和基于向量聚类的索引结构对于加速匹配效率的作用。本文对于理解TDM的学习过程和了解匹配技术的发展具有重要意义。 ... [详细]
  • Final关键字的含义及用法详解
    本文详细介绍了Java中final关键字的含义和用法。final关键字可以修饰非抽象类、非抽象类成员方法和变量。final类不能被继承,final类中的方法默认是final的。final方法不能被子类的方法覆盖,但可以被继承。final成员变量表示常量,只能被赋值一次,赋值后值不再改变。文章还讨论了final类和final方法的应用场景,以及使用final方法的两个原因:锁定方法防止修改和提高执行效率。 ... [详细]
  • 本文介绍了求解gcdexgcd斐蜀定理的迭代法和递归法,并解释了exgcd的概念和应用。exgcd是指对于不完全为0的非负整数a和b,gcd(a,b)表示a和b的最大公约数,必然存在整数对x和y,使得gcd(a,b)=ax+by。此外,本文还给出了相应的代码示例。 ... [详细]
  • 本文介绍了使用AJAX的POST请求实现数据修改功能的方法。通过ajax-post技术,可以实现在输入某个id后,通过ajax技术调用post.jsp修改具有该id记录的姓名的值。文章还提到了AJAX的概念和作用,以及使用async参数和open()方法的注意事项。同时强调了不推荐使用async=false的情况,并解释了JavaScript等待服务器响应的机制。 ... [详细]
  • 如何用UE4制作2D游戏文档——计算篇
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了如何用UE4制作2D游戏文档——计算篇相关的知识,希望对你有一定的参考价值。 ... [详细]
  • 本文介绍了使用PHP实现断点续传乱序合并文件的方法和源码。由于网络原因,文件需要分割成多个部分发送,因此无法按顺序接收。文章中提供了merge2.php的源码,通过使用shuffle函数打乱文件读取顺序,实现了乱序合并文件的功能。同时,还介绍了filesize、glob、unlink、fopen等相关函数的使用。阅读本文可以了解如何使用PHP实现断点续传乱序合并文件的具体步骤。 ... [详细]
  • 成功安装Sabayon Linux在thinkpad X60上的经验分享
    本文分享了作者在国庆期间在thinkpad X60上成功安装Sabayon Linux的经验。通过修改CHOST和执行emerge命令,作者顺利完成了安装过程。Sabayon Linux是一个基于Gentoo Linux的发行版,可以将电脑快速转变为一个功能强大的系统。除了作为一个live DVD使用外,Sabayon Linux还可以被安装在硬盘上,方便用户使用。 ... [详细]
  • 本文介绍了在CentOS 7.x上进行端口映射配置的方法,通过修改内核和配置防火墙实现端口映射。作者分享了自己使用华为服务器进行端口映射的经验,发现网速比直连还快且稳定。详细的配置过程包括开启系统路由模式功能、设置IP地址伪装、设置端口映射等。同时,还介绍了如何监听本地端口的tcp请求,以及删除规则和开放的端口的方法。 ... [详细]
author-avatar
手机用户2602920567
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有