時(shí)間:2023-06-29 11:06:01 | 來(lái)源:網(wǎng)站運(yùn)營(yíng)
時(shí)間:2023-06-29 11:06:01 來(lái)源:網(wǎng)站運(yùn)營(yíng)
我不是網(wǎng)管 - RHEL 8上使用Let s Encrypt證書(shū)保護(hù) Apache服務(wù)器:在一個(gè)不斷受到安全威脅的網(wǎng)絡(luò)世界中,確保您的 Web 服務(wù)器安全是最重要的事情。保護(hù)您的 Web 服務(wù)器的方法之一是使用 SSL/TLS 證書(shū)在網(wǎng)站上實(shí)現(xiàn) HTTPS 協(xié)議。SSL/TLS 證書(shū)不僅通過(guò)對(duì) Web 服務(wù)器和用戶瀏覽器之間交換的信息進(jìn)行加密來(lái)確保您的網(wǎng)站,還可以幫助 Google 排名。$ sudo dnf install -y httpd
安裝完成后,啟動(dòng) Apache web 服務(wù)器并使其在引導(dǎo)時(shí)啟動(dòng)。$ sudo systemctl start httpd$ sudo systemctl enable httpd
要驗(yàn)證 Apache 是否正在運(yùn)行,請(qǐng)執(zhí)行以下命令$ sudo systemctl status httpd
$ sudo firewall-cmd --add-port=80/tcp --permanent$ sudo firewall-cmd --add-port=443/tcp –permanent$ sudo firewall-cmd --realod
現(xiàn)在,你可以轉(zhuǎn)到你的瀏覽器,輸入你的域名訪問(wèn)。$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y
接下來(lái),按如下方法安裝 certbot 和 mod ssl 包$ sudo dnf install certbot python3-certbot-apache mod_ssl
$ sudo mkdir -p /var/www/linuxtechgeek.info/html
設(shè)置目錄歸屬為 Apache 用戶$ sudo chown -R apache:apache /var/www/linuxtechgeek.info/html
請(qǐng)確保按所示設(shè)置目錄權(quán)限$ sudo chmod -R 755 /var/www
接著在 /etc/httpd/conf.d 目錄中創(chuàng)建虛擬主機(jī)文件$ sudo vi /etc/httpd/conf.d/linuxtechgeek.info.conf
粘貼下面的內(nèi)容,注意使用自己的域名<virtualhost *:80>ServerName linuxtechgeek.infoServerAlias www.linuxtechgeek.infoDocumentRoot /var/www/linuxtechgeek.info/htmlErrorLog /var/log/httpd/linuxtechgeek.info-error.logCustomLog /var/log/httpd/linuxtechgeek.info-access.log combined</virtualhost>
保存并退出 VirtualHost 文件$ sudo vi /var/www/linuxtechgeek.info/html/index.html
粘貼以下示例內(nèi)容,您也可以根據(jù)自己的喜好隨意修改它。<!DOCTYPE html><html> <body> <h1> Welcome to Linuxtechi virtualhost </h1> </body></html>
保存并退出 HTML 文件。要保存所做的所有更改,請(qǐng)重新啟動(dòng) Apache web 服務(wù)器。$ sudo systemctl restart httpd
再次訪問(wèn)您的域名,您將看到剛剛配置的定制 HTML 頁(yè)面,而不是默認(rèn)的 Apache 歡迎頁(yè)面。$ sudo certbot --apache
When the command is executed, certbot will walk you through a series of prompts. You will be prompted for your email address and be required to agree to the Terms and conditions. You will also be asked whether you would like to receive periodic emails about EFF news, and campaigns about digital freedom.$ sudo certbot renew
當(dāng)需要模擬證書(shū)更新時(shí),使用該命令$ sudo certbot renew --dry-run
這只是模擬實(shí)際的證書(shū)更新,不執(zhí)行任何操作。$ crontab -e
指定下面的 cron 作業(yè),它將在每個(gè)午夜運(yùn)行。0 0 * * * /usr/bin/certbot renew > /dev/null 2>&1
關(guān)鍵詞:證書(shū),保護(hù),服務(wù),使用
客戶&案例
營(yíng)銷(xiāo)資訊
關(guān)于我們
客戶&案例
營(yíng)銷(xiāo)資訊
關(guān)于我們
微信公眾號(hào)
版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。