linux下配置Apache基於加密的認證訪問_PHP教程

來源:互聯網
上載者:User
1、首先要確認安裝了 mod_ssl模組

我的機器是centos是系統,執行下面命令

yum install -y mod_ssl

2、用openssl工具產生密鑰,認證請求檔案,認證

在/usr/local/httpd目下,執行以下命令。

2.1產生密鑰

openssl genrsa 1024 > server.key

說明:這是用128位rsa演算法產生密鑰,得到server.key檔案

2.2產生認證請求檔案

openssl req -new -out server.csr

說明:這是用步驟1的密鑰產生認證請求檔案server.csr, 這一步提很多問題,一一輸入

2.3產生認證

命令:openssl req -x509 -days 365 -key server.key -in server.csr > server.crt

說明:這是用步驟1,2的的密鑰和認證請求產生認證server.crt,-days參數指明認證有效期間,單位為天

3、 配置apache

修改httpd.conf

LoadModule ssl_module /usr/lib64/httpd/modules/mod_ssl.so

Listen 443
NameVirtualHost *:443

# General setup for the virtual host
DocumentRoot "/usr/local/httpd/htdocs/ssl"
ServerName ssl.baishiz.com:443
ServerAdmin you@example.com
ErrorLog "/usr/local/httpd/logs/error_log"
TransferLog "/usr/local/httpd/logs/access_log"

SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5

SSLCertificateFile "/usr/local/httpd/server.crt"
SSLCertificateKeyFile "/usr/local/httpd/server.key"


SSLOptions +StdEnvVars


SSLOptions +StdEnvVars

BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog "/usr/local/httpd/logs/ssl_request_log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

http://www.bkjia.com/PHPjc/738543.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/738543.htmlTechArticle1、首先要確認安裝了 mod_ssl模組 我的機器是centos是系統,執行下面命令 yum install -y mod_ssl 2、用openssl工具產生密鑰,認證請求檔案,認證...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.