1. 程式人生 > >centos下https詳細配置-SSL

centos下https詳細配置-SSL

1、 安裝mod_ssl

2、 Ssl.conf: 上面pem,下面key

通過yum來線上安裝mod_ssl

[[email protected] ~]# yum -y install mod_ssl      ← 線上安裝mod_ssl

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: data.nicehosting.co.kr

 * extras: data.nicehosting.co.kr

 * updates: data.nicehosting.co.kr

addons                                                   |  951 B     00:00

addons/primary                                           |  202 B     00:00

http://data.nicehosting.co.kr/os/CentOS/5.7/os/i386/repodata/repomd.xml: [Errno 14] HTTP Error 403: Forbidden

Trying other mirror.

base                                                     | 1.1 kB     00:00

base/primary                                             | 961 kB     00:40

base                                                                  2705/2705

http://data.nicehosting.co.kr/os/CentOS/5.7/extras/i386/repodata/repomd.xml: [Errno 14] HTTP Error 403: Forbidden

Trying other mirror.

extras                                                   | 2.1 kB     00:00

extras/primary_db                                        | 156 kB     00:06

http://data.nicehosting.co.kr/os/CentOS/5.7/updates/i386/repodata/repomd.xml: [Errno 14] HTTP Error 403: Forbidden

Trying other mirror.

updates                                                  | 1.9 kB     00:00

updates/primary_db                                       | 290 kB     00:12

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package mod_ssl.i386 1:2.2.3-53.el5.centos.3 set to be updated

--> Processing Dependency: httpd = 2.2.3-53.el5.centos.3 for package: mod_ssl

--> Processing Dependency: libdistcache.so.1 for package: mod_ssl

--> Processing Dependency: libnal.so.1 for package: mod_ssl

--> Running transaction check

---> Package distcache.i386 0:1.4.5-14.1 set to be updated

---> Package httpd.i386 0:2.2.3-53.el5.centos.3 set to be updated

--> Finished Dependency Resolution

Dependencies Resolved

================================================================================

 Package         Arch       Version                         Repository     Size

================================================================================

Installing:

 mod_ssl         i386       1:2.2.3-53.el5.centos.3         updates        93 k

Installing for dependencies:

 distcache       i386       1.4.5-14.1                      base          119 k

Updating for dependencies:

 httpd           i386       2.2.3-53.el5.centos.3           updates       1.2 M

Transaction Summary

================================================================================

Install       2 Package(s)

Upgrade       1 Package(s)

Total download size: 1.4 M

Downloading Packages:

(1/3): mod_ssl-2.2.3-53.el5.centos.3.i386.rpm            |  93 kB     00:03

(2/3): distcache-1.4.5-14.1.i386.rpm                     | 119 kB     00:05

(3/3): httpd-2.2.3-53.el5.centos.3.i386.rpm              | 1.2 MB     00:53

--------------------------------------------------------------------------------

Total                                            23 kB/s | 1.4 MB     01:02

warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897

updates/gpgkey                                           | 1.5 kB     00:00

Importing GPG key 0xE8562897 "CentOS-5 Key (CentOS 5 Official Signing Key) <[email protected]>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing     : distcache                                                1/4

  Updating       : httpd                                                    2/4

  Installing     : mod_ssl                                                  3/4

  Cleanup        : httpd                                                    4/4

Installed:

  mod_ssl.i386 1:2.2.3-53.el5.centos.3

Dependency Installed:

  distcache.i386 0:1.4.5-14.1

Dependency Updated:

  httpd.i386 0:2.2.3-53.el5.centos.3

Complete!

2HTTP 伺服器上配置mod_ssl

[1] 建立伺服器金鑰

[[email protected] ~]#  cd /etc/pki/tls/certs/  ← 進入HTTP伺服器配置檔案所在目錄

[[email protected] certs]#  make server.key  ← 建立伺服器金鑰

umask 77 ; \

               /usr/bin/openssl genrsa -des3 1024 > server.key

Generating RSA private key, 1024 bit long modulus

................++++++

......++++++

e is 65537 (0x10001)

Enter pass phrase:                      ← 在這裡輸入口令

Verifying - Enter pass phrase:   ← 確認口令,再次輸入

[[email protected] certs]#  openssl rsa -in server.key -out server.key  ← 從金鑰中刪除密碼(以避免系統啟動後被詢問口令)

Enter pass phrase for server.key:  ← 輸入口令

writing RSA key

[2] 建立伺服器公鑰

[[email protected] certs]#  make server.csr  ← 建立伺服器金鑰

umask 77 ; \

                /usr/bin/openssl req -utf8 -new -key server.key -out server.csr

You are about to be asked to enter information that will be incorporated

into your certificate request.

What you are about to enter is what is called a Distinguished Name or a DN.

There are quite a few fields but you can leave some blank

For some fields there will be a default value,

If you enter '.', the field will be left blank.

-----

Country Name (2 letter code) [GB]:CN  ← 輸入國名

State or Province Name (full name) [Berkshire]:Fujian  ← 輸入省名

Locality Name (eg, city) [Newbury]:Quanzhou  ← 輸入城市名

Organization Name (eg, company) [My Company Ltd]:www.51cto.com  ← 輸入組織名(任意)

Organizational Unit Name (eg, section) []:  ← 不輸入,直接回車

Common Name (eg, your name or your server's hostname) []:www.51cto.com  ← 輸入通稱(任意)

Email Address []:[email protected]   ← 輸入電子郵箱地址 

Please enter the following 'extra' attributes

to be sent with your certificate request

A challenge password []:  ← 不輸入,直接回車

An optional company name []:   ← 不輸入,直接回車

[3] 建立伺服器證書

[[email protected] certs]#  openssl x509 -in server.csr -out server.pem -req -signkey server.key -days 365  ← 建立伺服器證書

Signature ok

subject=/C=CN/ST=Fujian/L=Quanzhou/O=www.51cto.com/CN=www.51cto.com/[email protected]

Getting Private key

[[email protected] certs]#  chmod 400 server.*    ← 修改許可權為400

[4] 設定SSL

[[email protected] certs]#  vi /etc/httpd/conf.d/ssl.conf  ← 修改SSL的設定檔案

#DocumentRoot "/var/www/html"  ← 找到這一行,將行首的“#”去掉

 ↓

DocumentRoot "/var/www/html"  ← 變為此狀態

[5] 重新啟動HTTP服務,讓SSL生效

[[email protected] certs]#  /etc/rc.d/init.d/httpd restart  ← 重新啟動HTTP伺服器 

停止  httpd: 確定 ]

啟動 httpd:確定]


本地配置檔案/etc/httpd/conf.d/ssl_saturn.conf:

LoadModule wsgi_module modules/mod_wsgi.so
LoadModule ssl_module modules/mod_ssl.so
Listen 443


SSLPassPhraseDialog  builtin

SSLSessionCache         shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout  300

SSLMutex default

SSLRandomSeed startup file:/dev/urandom  256
SSLRandomSeed connect builtin

SSLCryptoDevice builtin

NameVirtualHost *:443
<VirtualHost *:443>

    DocumentRoot "/var/www/html/saturn"
    ServerName saturn.amap.com
    ErrorLog logs/ssl_error_log
    TransferLog logs/ssl_access_log
    LogLevel warn

    SSLEngine on

    SSLProtocol all -SSLv2

    SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW

    SSLCertificateFile /etc/pki/tls/certs/public.crt

    SSLCertificateKeyFile /etc/pki/tls/private/private.key

    SSLCertificateChainFile /etc/pki/tls/certs/intermediate.crt


    WSGIScriptAlias / /var/www/html/saturn/saturn/my.wsgi

    <Directory "/var/www/html/saturn">
       Order Deny,Allow
       Allow from all
    </Directory>

    Alias /static/ /var/www/html/saturn/static/
    <Directory "/var/www/html/saturn/static/">
        Order allow,deny
        #Options Indexes
        Options -Indexes -MultiViews
        Allow from all
        IndexOptions FancyIndexing
     </Directory>


    SetEnvIf User-Agent ".*MSIE.*" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0

    CustomLog logs/ssl_request_log \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>


相關推薦

centoshttps詳細配置-SSL

1、 安裝mod_ssl 2、 Ssl.conf: 上面pem,下面key 通過yum來線上安裝mod_ssl [[email protected] ~]# yum -y install mod_ssl      ← 線上安裝mod_ssl Lo

centos使用nginx 配置websocket,https升級wss協議

服務端程式碼/***/ // 服務端程式碼 var express = require('express'); var app = express(); var path = require('path'); var server = require('http').createServer(app)

Linux CentOS安裝、配置mysql數據庫

config 得到 操作 program except naconda 服務端 強力 fig 假設要在Linux上做j2ee開發。首先得搭建好j2ee的開發環境。包含了jdk、tomcat、eclipse的安裝(這個在之前的一篇隨筆中已經有具體解說了Linux學習之Ce

配置Tomcat使用https協議(配置SSL協議)

操作 method enable 安裝 文件的 chan 根據 域名 add 轉載地址:http://ln-ydc.iteye.com/blog/1330674 內容概覽: 如果希望 Tomcat 支持 Https,主要的工作是配置 SSL 協議 1.生成安全證書

CentOS RabbitMQ安裝配置:

net mini rtu 配置 list /var/ 解析 .rpm -a CentOS RabbitMQ rpm 安裝方法: 系統環境:CentOS6IP地址:10.100.62.41 1.erlang安裝: erlang下載地址: http://www.rabbitm

CentOS安裝與配置Maven

export http utf uri 阿裏 cor redhat odin ngs 安裝Maven 當前系統 [root@141 ~]# cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core) 下載 h

CentOS的apache配置支持php

.html 支持 lib 文件 centos .so php5 col pin 修改Apache的配置文件httpd.conf(vi /etc/httpd/conf/httpd.conf) DirectoryIndex index.html index.php #添加in

kali Linux為Apache2配置SSL證書

形式 line ech style ali crt select 配置 mod SSL證書是在阿裏雲免費申請的,下載的Apache版本。裏面有三個文件,一個a.key,一個a_public.crt和a_chain.crt。 其中官方文檔中配置是基於apache的httpd.

CentOS LNMP 環境配置

lock rom stc share ebo centos avi roo yum 源 安裝配置 Nginx 安裝配置 MySQL 安裝配置 PHP Nginx 與 PHP-FPM 集成 環境配置驗證 LNMP 環境代表 Linu

CentOS利用openvpn 搭建ssl-vpn

一、OpenVPN是靠虛擬的TUN/TAP裝置實現SSL VPN的,因此核心必須支援TUN/TAP裝置模組,這個配置選項在2.6.x核心中,位於Device Drivers ->Network device support 選單中,全稱是Universal TUN/TAP device dr

hadoop在CentOS的安裝配置

關閉 ssh 集群配置 cat ati shuffle manage map core 版本:CentOS-6.8-x86_64-minimal,hadoop2.6.4,jdk1.7.0 首先把jdk、hadoop壓縮包下載發送到CentOS下並解壓 下載發送不多贅

windows基於IIS配置ssl證書

我這邊用的是阿里雲的免費證書,下面展示一下操作步驟。 首先登陸阿里雲,搜尋ssl證書進入ssl證書控制檯。點選購買 然後選擇免費版,配置如下: 選擇立即購買,購買成功後回到ssl控制檯即可檢視證書。然後選擇申請繫結域名 點選申請後出現如下介面,選擇手動驗證: 點選下一步,然後需要手動

CentOSvsftpd服務配置說明

專案需要用到分使用者的FTP伺服器,因此花了一天時間學習了vsftpd服務的搭建和配置說明。記錄如下。 安裝 yum install vsftpd ftp 配置虛擬使用者 虛擬使用者即可以登入Ftp,不能登入系統。配置原理即開啟vs

【Linux】CentOSvim的配置

前言:    對於vim的配置,本人也在網上看了很多的方法,碰了很多 壁,所以就知道痛了。所以在下面給大家分享一下我如何配置vim的方法。配置環境  首先給說明下我的環境為CentOS6.5的版本,對於CentOS的配置應該都沒有問題,但是是其他系統的話,可以參考,可能因為環

Redhat/CentOSyum完美配置方案(順帶yum安裝memcached)

看到好多筒子們yum安裝memcached不成功,不幸的是,我也遇到了,由於各種原因,花了七八個小時才搞定。 看罈子裡好多筒子都有貼處理經驗,貌似不是很詳細徹底,我索性總結下,希望大家少走彎路。 條條大道通羅馬,但是最順暢的只有一條。。。 我的系統版本為:rhel5.3 3

ubuntu 14.04伺服器環境apache2.4配置SSL

最近因為開發微信小程式,需要在服務端搭建https,在網上找了幾篇配置SSL的部落格,感覺都不是特別滿意,感覺這一篇寫的還挺好的。1.查詢apache的SSL模組ubuntu下,apache的預設模組目錄是/usr/lib/apache2/modules/$ cd /usr/

Spring boot + Undertow + 騰訊雲https證書配置SSL訪問專案( 多個專案使用SSL也可以,需要利用Nginx )

tomcat的https配置和undertow差不多的,由於 spring boot + undertow + https的配置資料比較缺少,這裡寫一篇文章 1.單個主機上配置 先在pom.xml加入undertow容器依賴 <!--un

Centosvsftp的配置以及錯誤處理

    學習linux也有一段時間了,以前都是開個虛擬機器在虛擬機器下全屏搞學習,不過工作中貌似是沒有給我們在伺服器上寫程式碼的條件吧,所以決定模擬實際環境,配置一下學習環境     首先是安裝SecureCRT 我安裝的是7.0。 破解什麼的大家自己懂得。     然後是

centos從零配置nginx(負載均衡)

centos下從零配置nginx(負載均衡) nginx下載安裝 先下載依賴環境,不然裝不上 yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-

centos網路的配置

1、網路模式要進行使用NAT,要連網的話,要配置好設定:網路要進行一下共享到虛擬機器 進入vi /etc/sysconfig/network-scripts/ifcfg-eth0 把裡面的onboot=no改為onboot=yes BOOTPROTO=dhcp改為BOOTPROTO=static 再加上如