Apache 服务器配置详细教程
发布:smiling 来源: PHP粉丝网 添加日期:2013-11-23 15:03:49 浏览: 评论:0
ssl加密的配置
首先在配置之前先来了解一些基本概念:
证书的概念:首先要有一个根证书,然后用根证书来签发服务器证书和客户证书,一般理解:服务器证书和客户证书是平级关系。ssl必须安装服务器证书来认证。 因此:在此环境中,至少必须有三个证书:根证书,服务器证书,客户端证书。 在生成证书之前,一般会有一个私钥,同时用私钥生成证书请求,再利用证书服务器的根证来签发证书。
ssl所使用的证书可以自己生成,也可以通过一个商业性ca(如verisign 或 thawte)签署证书。
签发证书的问题:如果使用的是商业证书,具体的签署方法请查看相关销售商的说明;如果是知己签发的证书,可以使用openssl自带的ca.sh脚本工具。
如果不为单独的客户端签发证书,客户端证书可以不用生成,客户端与服务器端使用相同的证书。
(1) conf/ssl.conf 配置文件中的主要参数配置如下:
- listen 443
- sslpassphrasedialog buildin
- #sslpassphrasedialog exec:/path/to/program
- sslsessioncache dbm:/usr/local/apache2/logs/ssl_scache
- sslsessioncachetimeout 300
- sslmutex file:/usr/local/apache2/logs/ssl_mutex
- # general setup for the virtual host
- documentroot "/usr/local/apache2/htdocs"
- servername www.example.com:443
- serveradmin you@example.com
- errorlog /usr/local/apache2/logs/error_log
- transferlog /usr/local/apache2/logs/access_log
- sslengine on
- sslciphersuite all:!adh:!export56:rc4+rsa:+high:+medium:+low:+sslv2:+exp:+enull
- sslcertificatefile /usr/local/apache2/conf/ssl.crt/server.crt
- sslcertificatekeyfile /usr/local/apache2/conf/ssl.key/server.key
- customlog /usr/local/apache2/logs/ssl_request_log "%t %h %{ssl_protocol}x %{ssl_cipher}x "%r" %b"
(2) 创建和使用自签署的证书:
- a.create a rsa private key for your apache server
- /usr/local/openssl/bin/openssl genrsa -des3 -out /usr/local/apache2/conf/ssl.key/server.key 1024
- b. create a certificate signing request (csr)
- /usr/local/openssl/bin/openssl req -new -key /usr/local/apache2/conf/ssl.key/server.key -out /usr/local/apache2/conf/ssl.key/server.csr
- c. create a self-signed ca certificate (x509 structure) with the rsa key of the ca
- /usr/local/openssl/bin/openssl req -x509 -days 365 -key /usr/local/apache2/conf/ssl.key/server.key -in /usr/local/apache2/conf/ssl.key/server.csr -out /usr/local/apache2/conf/ssl.crt/server.crt
- /usr/local/openssl/bin/openssl genrsa 1024 -out server.key
- /usr/local/openssl/bin/openssl req -new -key server.key -out server.csr
- /usr/local/openssl/bin/openssl req -x509 -days 365 -key server.key -in server.csr -out server.crt
(3) 创建自己的ca(认证证书),并使用该ca来签署服务器的证书。
- mkdir /ca
- cd /ca
- cp openssl-0.9.7g/apps/ca.sh /ca
- ./ca.sh -newca
- openssl genrsa -des3 -out server.key 1024
- openssl req -new -key server.key -out server.csr
- cp server.csr newreq.pem
- ./ca.sh -sign
- cp newcert.pem /usr/local/apache2/conf/ssl.crt/server.crt
- cp server.key /usr/local/apache2/conf/ssl.key/
Tags: Apache 服务器 配置
相关文章
- ·在apache下限制每个虚拟主机的并发数(2013-11-14)
- ·APACHE禁止图片盗链(2013-11-14)
- ·Apache下的虚拟主机设置(2013-11-14)
- ·Apache中禁止IP段,在httpd.conf中的写法(2013-11-14)
- ·用Apache的rewrite生成伪静态页面(2013-11-14)
- ·HTTP/Apache 错误代码汇总(2013-11-14)
- ·Apache性能优化技巧(2013-11-22)
- ·用Session代替Apache服务器验证(2013-11-22)
- ·Apache中httpd.conf的中文件详解(2013-11-22)
- ·Apache中.Htaccess文件的功能写法(2013-11-22)
- ·如何让apache支持.htaccess并设置404错误页(2013-11-22)
- ·apache 虚拟主机配置[别名配置方法](2013-11-22)
- ·apache 服务器网站不能访问(2013-11-22)
- ·apache教程:.htaccess用法(2013-11-22)
- ·Apache二级域名配置方法(2013-11-22)
- ·apache 封IP基础教程(2013-11-22)

推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)