Ubuntu 5.10 下 Apache2 SSL 的配置方法

Ubuntu下Apache的配置文件跟Solaris和FreeBSD下面有点不“太”一样,不过本质上还是那些。有的时候我就奇怪,这一个软件在不同的平台上咋能折腾出这么多花样来。

Apache2在Ubuntu系统内的基本情况如下
默认站点在 /var/www/
配置文件在 /etc/apache2/
日志在 /var/log/apache/
启动脚本是 /usr/sin/apache2ctl 或者 /etc/init.d/apache2

安装Apache2
#apt-get install apache2

安装SSL模块
#a2enmod ssl

创建默认的SSL证书
#apache2-ssl-certificate

复制一份站点配置做为SSL配置的原型
#cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl
#ln -s /etc/apache2/sites-available/ssl /etc/apache2/sites-enabled/ssl


编辑SSL的配置
#vi /etc/apache2/sites-enabled/ssl
把端口改为443
加入SSL认证配置

其它的根据需要自己定制 与普通配置无异
NameVirtualHost *:443
<VirtualHost *:443>
    ServerSignature On
    SSLEngine On
    SSLCertificateFile /etc/apache2/ssl/apache.pem


    ServerAdmin webmaster@localhost
#[......]

修改普通http方式的配置
#vi /etc/apache2/sites-enabled/default
把端口改为80
NameVirtualHost *:80
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
#[......]

编辑Apache端口配置,加入443端口(SSL的)
#vi /etc/apache2/ports.conf:
Listen 80
Listen 443

重新载入Apache的配置
#/etc/init.d/apache2 force-reload

以下是SSL的配置文件的示例
NameVirtualHost *:443
<VirtualHost *:443>
        ServerSignature On
        SSLEngine On
        SSLCertificateFile /etc/apache2/ssl/apache.pem

        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/
        
<Directory />
                Options FollowSymLinks
                AllowOverride None
        
</Directory>
        
<Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                # Commented out for Ubuntu
                #RedirectMatch ^/$ /apache2-default/
        
</Directory>

0
0
(请您对文章做出评价)
« 上一篇:一行shell命令求素数
» 下一篇:Perl中不寻常的 ?: 运算符

posted on 2006-02-18 11:52 古月春秋 阅读(887) 评论(0)  编辑 收藏 网摘 所属分类: c/un*x

公告


导航

<2006年2月>
2930311234
567891011
12131415161718
19202122232425
2627281234
567891011

统计

  • 随笔 - 26
  • 文章 - 5
  • 评论 - 42
  • 引用 - 1

搜索

 

常用链接

我的标签

随笔分类

随笔档案

相册

收藏夹

Blog

编程

管理

技术参考

其它

最新评论

阅读排行榜

评论排行榜