久久精品水蜜桃av综合天堂,久久精品丝袜高跟鞋,精品国产肉丝袜久久,国产一区二区三区色噜噜,黑人video粗暴亚裔

CentOS/讓服務(wù)器支持安全HTTP協(xié)議

來自站長百科
Jiaomh討論 | 貢獻2011年2月1日 (二) 16:54的版本
(差異) ←上一版本 | 最后版本 (差異) | 下一版本→ (差異)
跳轉(zhuǎn)至: 導(dǎo)航、? 搜索

CentOS | CentOS安裝 | CentOS使用手冊

在我們通常用“http://”這樣的方式來訪問網(wǎng)站的時候,傳輸內(nèi)容是可能被別人截獲的,因為其內(nèi)容是通過明文傳輸,所以在傳遞一些隱私、以及密碼相關(guān)的信息時,就顯得非常的不安全。在一些比較正式的網(wǎng)站、以及一些銀行相關(guān)的網(wǎng)站中,一些需要提交隱私或者重要級別比較高的密碼時,都采用“https://”的方式,來將傳輸內(nèi)容加密,從而保證用戶安全和避免隱私的泄漏。

在這里,我們通過mod_ssl來使我們的服務(wù)器也支持HTTPS。

安裝mod_ssl[ ]

首先通過yum來在線安裝mod_ssl。

[root@sample html]# yum -y install mod_ssl  ← 在線安裝mod_ssl

Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Reducing Dag RPM Repository for Red Hat Enterprise Linux to included packages only
Finished
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for mod_ssl to pack into transaction set.
mod_ssl-2.0.52-28.ent.cen 100% |=========================| 25 kB 00:00
---> Package mod_ssl.i386 1:2.0.52-28.ent.centos4 set to be updated
--> Running transaction check
--> Processing Dependency: libnal.so.1 for package: mod_ssl
--> Processing Dependency: libdistcache.so.1 for package: mod_ssl
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for distcache to pack into transaction set.
distcache-1.4.5-6.i386.rp 100% |=========================| 7.2 kB 00:00
---> Package distcache.i386 0:1.4.5-6 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
mod_ssl i386 1:2.0.52-28.ent.centos4 base 98 k
Installing for dependencies:
distcache i386 1.4.5-6 base 111 k

Transaction Summary
=============================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 209 k
Downloading Packages:
(1/2): distcache-1.4.5-6. 100% |=========================| 111 kB 00:00
(2/2): mod_ssl-2.0.52-28. 100% |=========================| 98 kB 00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: distcache ######################### [1/2]
Installing: mod_ssl ######################### [2/2]

Installed: mod_ssl.i386 1:2.0.52-28.ent.centos4
Dependency Installed: distcache.i386 0:1.4.5-6
Complete!

為HTTP服務(wù)器配置mod_ssl[ ]

[1] 建立服務(wù)器密鑰

[root@sample conf]# cd /etc/httpd/conf  ← 進入HTTP服務(wù)器配置文件所在目錄

[root@sample conf]# rm -f ssl.*/server.*  ← 刪除默認或殘留的服務(wù)器證書相關(guān)文件

[root@sample conf]# make genkey  ← 建立服務(wù)器密鑰
umask 77 ; \
/usr/bin/openssl genrsa -des3 1024 > /etc/httpd/conf/ssl.key/server.key
Generating RSA private key, 1024 bit long modulus
................++++++
....................................................................++++++
e is 65537 (0x10001)
Enter pass phrase:  ← 在這里輸入口令
Verifying - Enter pass phrase:  ← 確認口令,再次輸入

[root@sample conf]# openssl rsa -in ssl.key/server.key -out ssl.key/server.key  
← 從密鑰中刪除密碼(以避免系統(tǒng)啟動后被詢問口令)

Enter pass phrase for ssl.key/server.key:  ← 輸入口令
writing RSA key

[2] 建立服務(wù)器公鑰

[root@sample conf]# make certreq  ← 建立服務(wù)器密鑰

umask 77 ; \
/usr/bin/openssl req -new -key /etc/httpd/conf/ssl.key/server.key -out 
/etc/httpd/conf/ssl.csr/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]:Heilongjiang  ← 輸入省名
Locality Name (eg, city) [Newbury]:Harbin  ← 輸入城市名
Organization Name (eg, company) [My Company Ltd]:www.centospub.com  ← 輸入組織名(任意)
Organizational Unit Name (eg, section) []:  ← 不輸入,直接回車
Common Name (eg, your name or your server's hostname) []:www.centospub.com  ← 輸入通稱(任意)
Email Address []:yourname@yourserver.com  
 ← 輸入電子郵箱地址 Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:  ← 不輸入,直接回車
An optional company name []:   ← 不輸入,直接回車

[3] 建立服務(wù)器證書

[root@sample conf]# openssl x509 -in ssl.csr/server.csr -out ssl.crt/server.crt -req 
-signkey ssl.key/server.key -days 365  ← 建立服務(wù)器證書

Signature ok
subject=/C=CN/ST=Heilongjiang/L=Harbin/O=
www.centospub.com/CN=www.centospub.com/emailAddress=yourname@yourserver.com
Getting Private key

[4] 設(shè)置SSL

[root@sample conf]# vi /etc/httpd/conf.d/ssl.conf  ← 修改SSL的設(shè)置文件

#DocumentRoot "/var/www/html"  ← 找到這一行,將行首的“#”去掉
 ↓
DocumentRoot "/var/www/html"  ← 變?yōu)榇藸顟B(tài)

[5] 重新啟動HTTP服務(wù)器,讓SSL生效

[root@sample conf]# /etc/rc.d/init.d/httpd restart  ← 重新啟動HTTP服務(wù)器 

Stopping httpd:               [ OK ]
Starting httpd:              [ OK ]

[6] 設(shè)置防火墻允許SSL

[root@sample conf]# vi /etc/sysconfig/iptables   ← 編輯防火墻配置文件 

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT  
← 找到這一行,接著添加如下行:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT  
← 開放443號端口,允許SSL

[root@sample conf]# /etc/rc.d/init.d/iptables restart   ← 重新啟動防火墻,使設(shè)置生效

Flushing firewall rules:            [ OK ]
Setting chains to policy ACCEPT: filter    [ OK ]
Unloading iptables modules:         [ OK ]
Applying iptables firewall rules:       [ OK ]

測試SSL[ ]

可以通過自用PC來測試SSL。打開瀏覽器,在地址欄輸入“https://服務(wù)器IP地址”或者“https://你的域名”后,如果出現(xiàn)提示安裝服務(wù)器證明書的窗口(圖樣如下),說明服務(wù)器已經(jīng)支持SSL。

Sslcli.gif

這時,如果選擇“永遠接受此證書”,然后點擊確定后,再次通過HTTPS協(xié)議訪問該站點,將不會再彈出此窗口提示安裝服務(wù)器證書。

參考來源[ ]

http://www.centospub.com/make/ssl.html

CentOS使用手冊導(dǎo)航

CentOS安裝

CentOS安裝 | 系統(tǒng)安裝后的初始環(huán)境設(shè)置 | 服務(wù)器方式安裝CentOS 5

CentOS使用手冊

使用RPM管理包 | 使用YUM工具更新系統(tǒng) | 使用rsync服務(wù) | 使用rsync同步 | 使用tar備份 | 使用tar恢復(fù)文件 | Samba 服務(wù)器的構(gòu)建 | 用SWAT讓Samba服務(wù)器的管理溫和化 | SMTP服務(wù)器的構(gòu)建 | POP/IMAP服務(wù)器的構(gòu)建 | 病毒查殺系統(tǒng)的構(gòu)建 | 入侵監(jiān)測系統(tǒng)的構(gòu)建 | 用OpenSSH構(gòu)建SSH服務(wù)器 | 用SSH客戶端軟件登錄到服務(wù)器 | 讓服務(wù)器支持安全HTTP協(xié)議 | 開放一般用戶的網(wǎng)頁發(fā)布權(quán)限 | 虛擬主機的構(gòu)建 | Servlet/JSP服務(wù)器的構(gòu)建 | 基于日志的站點統(tǒng)計系統(tǒng)的構(gòu)建 | 構(gòu)建MySQL數(shù)據(jù)庫服務(wù)器 | 用phpMyAdmin讓MySQL數(shù)據(jù)庫管理溫和化 | 數(shù)據(jù)庫的自動備份與恢復(fù) | 用ProFTPD構(gòu)建FTP服務(wù)器 | 用FTP客戶端軟件連接到服務(wù)器