Linux+Apache+openssl

实现https验证apache2.0 https

首先安装SSL,再编译安装APACHE,再配置证书即可

1.下载apache和openssl

网址:

http://www.apache.org

http://www.openssl.org

2.解压

#tar zxvf httpd-2.0.54.tar.gz

#tar zxvf openssl-0.9.7g.tar.gz

3.编译安装openssl,

这个软件主要是用来生成证书:

#cd openssl-0.9.7g

#./config

#make

#make test

#make install

把openssl放进内核目录下,使其在任何目录下都能运行。

#cd /usr/local/bin

#ln -s /usr/local/ssl/bin/openssl openssl

4.编译安装

apache

#cd /opt/httpd-2.0.54

#./configure --prefix="/opt/apache2" --enable-so --enable-ssl

--with-ssl="/usr/local/ssl/bin"

#make

#make install

5.安装完毕,生成证书:

在/opt/apache2/conf 下建立一个ssl.key目录

#cd ../apache2/

#cd conf/

#mkdir ssl.key

然后在该目录下生成证书:

#cd ssl.key/

生成服务器私钥:

#openssl genrsa -des3 -out server.key 1024

Generating RSA private key, 1024 bit long modulus

.......................++++++

.................................................++++++

e is 65537 (0x10001)

Enter pass phrase for server.key:

Verifying - Enter pass phrase for server.key:

生成服务器证书请求,并按要求填些相关证书信息:

#openssl req -new -key server.key -out server.csr

Enter pass phrase for server.key:

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) [AU]:

State or Province Name (full name) [Some-State]:

Locality Name (eg, city) []:tyl

Organization Name (eg, company) [Internet Widgits Pty Ltd]:tz

Organizational Unit Name (eg, section) []:tz

Common Name (eg, YOUR name) []:tyl

Email Address []:[email protected]

Please enter the following ‘extra‘ attributes

to be sent with your certificate request

A challenge password []:

An optional company name []:

签证:

# openssl x509 -req -days 700 -in server.csr -signkey server.key -out

server.crt

Signature ok

subject=/C=AU/ST=Some-State/L=tyl/O=tz/OU=tz/CN=tyl/emailAddress=tan

[email protected]

Getting Private key

Enter pass phrase for server.key:

为了安全,然后我们把这些文件的权限都设为400

chmod 400 server.key

chmod 400 server.cert

最后对

/opt/apache2/conf/ssl.conf

进行修改:

vi /opt/apache2/conf/ssl.conf

修改的地方如下几处:

#SSLCertificateFile /opt/apache2/conf/ssl.crt/server.crt #108行

SSLCertificateFile /opt/apache2/conf/ssl.key/server.cert

#SSLCertificateFile /opt/apache2/conf/ssl.crt/server-dsa.crt

SSLCertificateKeyFile /opt/apache2/conf/ssl.key/server.key   #116行

#SSLCertificateKeyFile /opt/apache2/conf/ssl.key/server-dsa.key

这样我们就基本配好了ssl

现在我们来让apache启动ssl

/opt/apache2/bin/apachectl start

然后要求输入证书密码,正确输入后ssl就连同apache一起启动

在浏览器中输入:https://localhost要求下载证书,OK~好了~结束~就是这么简单。

Linux+Apache+openssl

时间: 2024-08-01 12:02:03

Linux+Apache+openssl的相关文章

CentOS 6.5下源码安装LAMP(Linux+Apache+Mysql+Php)环境

CentOS 6.5下源码安装LAMP(Linux+Apache+Mysql+Php)环境一. 系统环境:Linux系统版本: CentOS release 6.5Apache版本: httpd-2.2.24PHP 版本: php-5.6.11 二.安装前准备: 1.查看是否安装GCC ,GCC-C++编译器,如果没有则进行安装: 查看是否安装的命令: #gcc –v 若未安装在服务器联网情况下可以使用下列命令安装: #yum install gcc #yum install gcc-c++2.

WEB平台架构之:LAMP(Linux+Apache+MySQL+PHP)

WEB平台架构之:LAMP(Linux+Apache+MySQL+PHP)  从业界来看,最主流的web平台架构就当属LAMP了.LAMP架构可以说是一切web平台的基础架构,所有一切的所谓大型架构无非就是通过一些负载均衡技术,集群技术,缓存技术等结合LAMP平台组合而成以便来满足现实生产环境中的需求.因此很有必要聊一聊LAMP平台架构的搭建.本文会对LAMP平台相对性的聊一聊其搭建过程,根据个人的知识知无不说,更多的技术将会陆续整理成博客文章.我的要求没那么多,笨蛋的技术,只求看文章的人,都能

编译安装 Linux+Apache+MySQL+PHP

◆案例◆ 编译安装 Linux+Apache+MySQL+PHP  1.安装libxml2 Libxml2 是一个xml c语言版的解析器,本来是为Gnome项目开发的工具,是一个基于MIT License的免费开源软件.它除了支持c语言版以外,还支持c++.PHP.Pascal.Ruby.Tcl等语言的绑定,能在Windows.Linux.Solaris.MacOsX等平台上运行.功能还是相当强大的,相信满足一般用户需求没有任何问题. libxml是一个用来解析XML文档的函数库.它用C语言写

How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu

About LAMP LAMP stack is a group of open source software used to get web servers up and running. The acronym stands for Linux, Apache, MySQL, and PHP. Since the virtual private server is already running Ubuntu, the linux part is taken care of. Here i

Ubuntu下(Linux+Apache+MYSQL+PHP, LAMP)环境搭建

最近开始玩PHP,于是试着搭建一下开发环境并做个记录,以备日后再使用起来方便可查. 第一步 确保软件包是最新的 <span style="font-size: 18px;">sudo apt-get update</span> 第二步 安装Apache2 <span style="font-size: 18px;">sudo apt-get install apache2</span> 安装之后测试:在浏览器中打开 h

Lamp(linux+apache+mysql+php)环境搭建

Lamp(linux+apache+mysql+php)环境搭建 1.安装apache2:sudo apt-get installapache2 安装完毕后.执行例如以下命令重新启动apache:sudo/etc/init.d/apache2 restart,在浏览器中输入http://localhost或者http://127.0.0.1,会看到"It works!"说明apache成功安装. 2.安装php:sudoapt-get install libapache2-mod-ph

Linux Apache error 日志 提示[warn] child process 7751 still did not exit, sending a SIGTERM

Apache吃空内存,频繁宕机 在部署一套内网测试环境时,频繁宕机,开机后不断的吃内存,重启apache之后内存占用会不停的上涨,直到swap用完,直到死机,由于是内网环境,服务器并发和压力都很小. 查看apache错误日志,报大量类似错误: [Tue Feb 14 14:49:28 2012] [warn] child process 7751 still did not exit, sending a SIGTERM [Tue Feb 14 14:49:30 2012] [error] ch

linux apache 自动监护脚本

1 首先安装curl yum install curl 2 编写shell vi restart_apache.sh 写入一下内容 #!/bin/bashURL="http://127.0.0.1/"curlit(){curl --connect-timeout 35 --max-time 40 --head --silent "$URL" | grep '200'} doit(){if ! curlit; thensleep 20top -n 1 -b >&

Ubuntu下的LAMP(Linux+Apache+MySQL+PHP) 开发环境架设

LAMP在业界是一个非常流行的词语,这4个字母分别代表Linux,Apache,MySQL和PHP.LAMP以其高效.灵活的特性已经成为中小企业的首选. 以前介绍一种迅速搭建LAMP的方式. 1 在Ubuntu上打开终端,输入 sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server 一口气就可以下载(apache2,php5,mysql)三个工具 2 安装MySQL的时候,会让你设定一个Root管理员的密码