• linux 搭建https server (apache)


    一、  安装准备


    1.    安装Openssl 
    要使Apache支持SSL,须要首先安装Openssl支持。这里使用的是openssl-0.9.8k.tar.gz   
    下载Openssl:http://www.openssl.org/source/
           tar -zxf openssl-0.9.8k.tar.gz    //解压安装包   
           cd openssl-0.9.8k                 //进入已经解压的安装包   
           ./config                          //配置安装。推荐使用默认配置   
           make && make install              //编译及安装   
    openssl默认将被安装到/usr/local/ssl 

    2.    安装Apache  

    http://httpd.apache.org/下载httpd源码,这里使用的是httpd2.2.22;
    ./configure --prefix=/usr/local/httpd2.2.22 --enable-so --enable-ssl --with-ssl=/usr/local/ssl --enable-mods-shared=all                               //配置安装。

    推荐动态编译模块   
    make && make install  
    动态编译Apache模块,便于模块的载入管理。Apache 将被安装到/usr/local/apache   

    二、  生成证书

    为了高速搭建好可用的httpsserver,须要在/usr/local/httpd2.2.22/conf/文件夹下

    (也能够在别的文件夹下生成,将生成后的文件复制到/usr/local/httpd2.2.22/conf/文件夹下)

    依次执行下面命令:

    1. openssl req -new -text -out server.req

    2. openssl rsa -in privkey.pem -out server.key 

    3. openssl req -x509 -in server.req -text -key server.key -out server.crt


    详细的能够參考openssl文档;

       
    三、  Apache 的配置   

       
    打开apache安装文件夹下conf文件夹中的httpd.conf文件,找到   
    #LoadModule ssl_module modules/mod_ssl.so   
    删除行首的配置语句凝视符号“#”   
    保存退出。   
    打开apache安装文件夹下conf文件夹中的ssl.conf文件,找到   
    在配置文件里查找下面配置语句   
    SSLCertificateFile conf/ssl.crt/server.crt             将服务器证书配置到该路径下   
    SSLCertificateKeyFile conf/ssl.key/server.key        将服务器证书私钥配置到该路径下   
    #SSLCertificateChainFile conf/ssl.crt/ca.crt          删除行首的“#”号凝视符,并将中级CA证书intermediate.crt配置到该路径下   
    保存退出。并重新启动Apache。

    重新启动方式:   
    进入Apache安装文件夹下的bin文件夹,执行例如以下命令   
    ./apachectl -k -stop   
    ./apachectl start

    通过https方式訪问您的网站,測试网站证书的安装配置。

     
      

    此时即能够通过http和https訪问搭建好的server;


    參考文档:

    http://sarsgetaway.iteye.com/blog/1121495

    http://www.postgresql.org/docs/8.4/static/ssl-tcp.html

  • 相关阅读:
    Python笔记_第一篇_面向过程_第一部分_7.文件的操作(.txt)
    Python笔记_第一篇_面向过程_第一部分_6.语句的嵌套
    Python笔记_第一篇_面向过程_第一部分_6.其他控制语句(with...as等)
    Python笔记_第一篇_面向过程第一部分_6.循环控制语句(while 和 for)_
    Python笔记_第一篇_面向过程_第一部分_6.条件控制语句(if)
    matplot 代码实例
    python下的MySQLdb使用
    vim操作笔记
    使用k-近邻算法改进约会网站的配对效果
    python 读取文本
  • 原文地址:https://www.cnblogs.com/yfceshi/p/7110418.html
Copyright © 2020-2023  润新知