您好,登錄后才能下訂單哦!
今天就跟大家聊聊有關RHEL6.3下如何簡單配置Apache https,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結了以下內容,希望大家根據這篇文章可以有所收獲。
在默認情況下,Apache允許客戶端進行匿名訪問,但Apache也可以實現基于加密的認證訪問。這里做一個DEMO的實現過程詳解。
一、安裝相應支持模塊
首先在/etc/httpd/conf.d下查看有沒有ssl.conf文件,如果沒有需要安裝mod_ssl加密支持模塊。
[root@localhost Desktop]# cd /etc/httpd/conf.d
[root@localhost conf.d]# ls
mod_dnssd.conf README welcome.conf
使用YUM源來安裝
[root@localhost rhel6]# yum -y install mod_ssl
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
RHEL | 4.0 kB 00:00 ...
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mod_ssl.i686 1:2.2.15-15.el6_2.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
mod_ssl i686 1:2.2.15-15.el6_2.1 RHEL 88 k
Transaction Summary
================================================================================
Install 1 Package(s)
Total download size: 88 k
Installed size: 181 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : 1:mod_ssl-2.2.15-15.el6_2.1.i686 1/1
Installed products updated.
Verifying : 1:mod_ssl-2.2.15-15.el6_2.1.i686 1/1
Installed:
mod_ssl.i686 1:2.2.15-15.el6_2.1
Complete!
[root@localhost conf.d]# ls
mod_dnssd.conf README ssl.conf welcome.conf
二、加密配置
在ssl.conf文件中有這么兩句,指出了證書和私鑰的存放路徑
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
三、證書生成
[root@localhost conf.d]# cd /etc/pki/tls/certs
[root@localhost certs]# ls
ca-bundle.crt ca-bundle.trust.crt localhost.crt make-dummy-cert Makefile
先刪除原有的localhost.crt證書文件,再有make命令生成一個測試用的證書文件
[root@localhost certs]# rm -rf localhost.crt
[root@localhost certs]# make testcert
umask 77 ; \
/usr/bin/openssl req -utf8 -new -key /etc/pki/tls/private/localhost.key -x509 -days 365 -out /etc/pki/tls/certs/localhost.crt -set_serial 0
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) [US]:CN
State or Province Name (full name) []:
Locality Name (eg, city) [Default City]:Beijing
Organization Name (eg, company) [Default Company Ltd]:Tianli
Organizational Unit Name (eg, section) []:RedHat
Common Name (eg, your name or your server's hostname) []:test1.demo.com
Email Address []:
[root@localhost certs]#
四、測試驗證
[root@localhost certs]# cd /var/www/html
[root@localhost html]# ls
[root@localhost html]# touch index.html
[root@localhost html]# echo "welcomt to beijing" > index.html
[root@localhost html]# cat index.html
welcome to beijing
[root@localhost html]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@localhost html]# links -dump http://test1.demo.com
welcome to beijing
使用http顯示頁面正常
[root@localhost html]# links -dump https://test1.demo.com
ELinks: SSL error
使用https顯示頁面則出現SSL error
下面使用瀏覽器看一下效果
[root@localhost html]# firefox
在地址欄中輸入https://test1.demo.com
在如上頁面中,點擊I Understand the Risks選項
點擊Add Exception
點擊View 可以查看這張自頒發的證書信息。
點擊Confirm Security Exception,然后瀏覽器將顯示頁面內容。
看完上述內容,你們對RHEL6.3下如何簡單配置Apache https有進一步的了解嗎?如果還想了解更多知識或者相關內容,請關注億速云行業資訊頻道,感謝大家的支持。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。