Apache2配置SSL
生活随笔
收集整理的這篇文章主要介紹了
Apache2配置SSL
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
除了上一節所使用的軟件外,此教程還需openssl(版本需大于0.98)
openssl-1.0.2o.tar.g
1 openssl編譯安裝
tar -zxvf openssl-1.0.2o.tar.g cd openssl-1.0.2o ./config --prefix=/usr/local/openssl -fPIC (此處需帶上-fPIC) make depend make install2 httpd編譯安裝
httpd需重新編譯,上一節使用的格式為:
./configure --prefix=/usr/apache2 --with-includer-apr=/httpd-安裝路徑根目錄/srclib/apr --with-includer-apr-util=/httpd-安裝路徑根目錄/srclib/apr-util但這樣編譯出來的apache2中modules不包含mod_ssl.so,若想使用ssl,還必須有這個文件,故需重新編譯
tar -zxvf httpd-2.4.33.tar.gz cd httpd-2.4.33 #--enable-ssl用于生成帶SSL的apache2,--with-ssl表明所使用的openssl ./configure --prefix=/usr/apache2 --with-apr=/home/xuyaohui/apache2/httpd-2.4.33/srclib/apr --with-apr-util=/home/xuyaohui/apache2/httpd-2.4.33/srclib/apr-util --with-pcre=/home/xuyaohui/apache2/httpd-2.4.33/srclib/pcre --enable-ssl --with-ssl=/usr/local/openssl make make install3 生成server.key/server.csr
#生成server.key openssl genrsa 1024 -des3 > /存放key的根路徑/server.key #生成server.csr,此步會提示輸入參數 openssl req -new -key server.key > /存放csr的根路徑/server.csr #生成證書 openssl req -x509 -days 365 -key /存放key的根路徑/server.key -in /存放csr的根路徑/server.csr > /存放crt的根路徑/server.crt4 配置httpd.conf
#cd /apache2安裝根目錄/conf cd /usr/apache2/conf(這是我的安裝路徑) vim httpd.conf 修改如下:Include conf/extra/httpd-ssl.conf LoadModule ssl_module modules/mod_ssl.so cd ../extra/ vim httpd-ssl.conf 修改內容:SSLCertificateFile /存放crt的根路徑/server.crt SSLCertificateKeyFile /存放key的根路徑/server.key啟動測試
cd /usr/apache2 #修改ServerName vim conf/httpd.conf 修改:ServerName localhost:80 #啟動 cd .. cd bin ./apachectl start #訪問網址:localhost 是否出現It works!字樣,表示成功!問題
SSLSessionCache: ‘shmcb’ session cache not supported (known names: )
解決方法:
總結
以上是生活随笔為你收集整理的Apache2配置SSL的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 源代码编译安装Apache2
- 下一篇: 解决虚机中的Centos7连不上网