CentOS安装Apache2带SSL支持(mod_ssl, openssl)
2011-12-20 16:10
381 查看
下面是介绍源码安装Apache并配置ssl支持的教程。
安装Apache支持SSL/TLS
提示:默认安装路径为 /usr/local/apache2,如果你想改变路径,在./configure命令中使用–prefix自定义。
然后取消Include conf/extra/httpd-ssl.conf的注释。
ssl配置文件在/usr/local/apache2/conf/extra/httpd-ssl.conf,默认就行,不需要更改。
httpd-ssl.conf配置文件显示,需要server.crt和server.key两个文件,下面来介绍如何生成。
执行以上的命令会要求输入密码,请记住这个密码,后面的设置需要到。
下一步是使用上面生成的server.key文件创建server.csr证书文件。
最后,根据上面的server.key和server.csr两个文件生成私人签名的server.crt证书。
接着会要求输入上面设置的私人密钥的密码。
之后,你就可以通过https://ip访问你的网站。
转载地址:http://www.centos.bz/2011/10/centos-install-apache-ssl/
安装所需软件包
yum -y install gcc openssl openssl-devel
下载Apache源码
到http://httpd.apache.org/下载最新稳定版的源码,现在最新稳定版是2.2.21。cd ~ wget http://apache.deathculture.net//httpd/httpd-2.2.21.tar.gz tar xvfz httpd-2.2.21.tar.gz
安装Apache支持SSL/TLS
cd httpd-2.2.21 ./configure --enable-ssl --enable-so make make install
提示:默认安装路径为 /usr/local/apache2,如果你想改变路径,在./configure命令中使用–prefix自定义。
配置httpd.conf运行ssl
vi /usr/local/apache2/conf/httpd.conf
然后取消Include conf/extra/httpd-ssl.conf的注释。
ssl配置文件在/usr/local/apache2/conf/extra/httpd-ssl.conf,默认就行,不需要更改。
httpd-ssl.conf配置文件显示,需要server.crt和server.key两个文件,下面来介绍如何生成。
创建server.crt和server.key
首先,使用openssl生成server.key。cd ~ openssl genrsa -des3 -out server.key 1024
执行以上的命令会要求输入密码,请记住这个密码,后面的设置需要到。
下一步是使用上面生成的server.key文件创建server.csr证书文件。
openssl req -new -key server.key -out server.csr
最后,根据上面的server.key和server.csr两个文件生成私人签名的server.crt证书。
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
复制server.key和server.crt文件
cd ~ cp server.key /usr/local/apache2/conf/ cp server.crt /usr/local/apache2/conf/
启动apache并验证ssl
/usr/local/apache2/bin/apachectl start
接着会要求输入上面设置的私人密钥的密码。
Apache/2.2.21 mod_ssl/2.2.21 (Pass Phrase Dialog) Some of your private key files are encrypted for security reasons. In order to read them you have to provide the pass phrases. Server www.example.com:443 (RSA) Enter pass phrase: OK: Pass Phrase Dialog successful.
之后,你就可以通过https://ip访问你的网站。
转载地址:http://www.centos.bz/2011/10/centos-install-apache-ssl/
相关文章推荐
- CentOS安装Apache2带SSL支持(mod_ssl, openssl)
- CentOS 安装CDH报缺少cyrus-sasl-gssapi、MySQL-python、mod_ssl、openssl-devel等包的错误
- Windows2000_下_APACHE+OpenSSL+MOD_SSL_的安装
- 安装apache2虚拟主机并支持ssl(debian)
- openssl + apache + mod_ssl安装配置调试过程-
- 在CentOS5.2+apache2.2下安装配置mod_ssl
- openssl + apache + mod_ssl安装配置调试过程
- raspberry 安装apache2,使其支持ssl ,并创建自签名证书
- CentOS 4.4 编译安装 apache 2.2.4(mod_ssl)+php 5.2.1 wi
- 如何建立mod_fcgid Apache2中支持php5在CentOS 5.6上
- centos中编译安装nginx并支持ssl
- 在CentOS5.2+apache2.2下安装配置mod_ssl
- 在CentOS5.2+apache2.2下安装配置mod_ssl
- centos64位,apache2,python2.5,django,mod_python平台安装配置。
- Linux下apache、openssl、mod_ssl安装、配置
- CentOS 下编译安装 Apache 并配置 SSL 模块以支持 HTTPS
- openssl + apache + mod_ssl安装配置调试过程
- centos编译安装配置支持ssl加密的mysql replication
- CentOS 6下,远程安装KVM虚拟机,并使用apache mod_proxy反向代理建立多个web服务器
- 【Nginx】之安装使用和配置SSL支持