簡體   English   中英

使用 Let's Encrypt 為 Icecast2 添加 HTTPS 支持

[英]Add HTTPS support to Icecast2 using Let's Encrypt

我有一個在默認端口8000上運行的 Icecast2 服務器,我想使用免費的 Let's Encrypt 證書為其添加 HTTPs 支持。 例如:

  • http://example.com:8000/test.mp3 (當前)
  • https://example.com/test.mp3 (所需)

我已經看到 Icecast2 在內部支持 SSL 但該選項在某些(大多數?)GNU/Linux 發行版中不可用。 此外,我看到使用內部 SSL 支持與 Let's Encrypt 的集成度不高,因為您必須將兩個證書連接到一個文件中。

https://icecast.org/docs/icecast-2.4.1/config-file.html

https://community.letsencrypt.org/t/icecast2-and-letsencrypt/9329

問題:使用 Let's Encrypt 向 Icecast2 添加https://支持的建議方法是什么?

例如,使用來自 Debian GNU/Linux 穩定版的官方 icecast2 package ,無需編譯任何東西。 請注意,在服務器上我已經運行了網絡服務器 Apache HTTPd ( apache2 ),監聽端口80443 謝謝!

你的 icecast2 package 有原生的 SSL 支持嗎?

如果你喜歡使用官方的 package,首先檢查你已經安裝的icecast2 package 是否支持 SSL:

ldd /usr/bin/icecast2 | grep ssl

如果您沒有看到任何內容,則表明您沒有對 SSL 的本機支持。在這種情況下,您可以選擇以下選項之一:

  • A : 刪除 package 並安裝其他東西
  • B :使用 nginx 設置前端網絡服務器
  • C :使用 Apache 設置前端網絡服務器(← 這個答案)

如何使用 Apache 設置支持 HTTPs 的前端網絡服務器,並為 Icecast2 提供服務

如果您想為 Icecast 提供https://支持,您可以安裝 Apache 並將其用作前端 Web 服務器,監聽標准端口 443。使用 Let's Encrypt 創建免費證書很容易。 一旦成功,您就可以將流量傳遞給 Icecast2。

如果你使用 Debian GNU/Linux,這里有指南:

解決方案的核心是像這樣啟用一個 apache VirtualHost:

#
# Apache VirtualHost serving my Icecast under HTTPs (:443)
#
# This frontend webserver passes all the traffic to
# the underlying Icecast, listening on port 8000.
#
# The certificate comes from Let's Encrypt.
#
# Credits: https://stackoverflow.com/a/71383133/3451846
<virtualhost *:443>

  ServerName example.com

  # this path is not useful and it's used only for Let's Encrypt's temporary files during the renewal process
  DocumentRoot /var/www/html

  # send all traffic to Icecast in plaintext
  <Location "/">
    ProxyPass        http://localhost:8000/
    ProxyPassReverse http://localhost:8000/
  </Location>

  # these files are served from /var/www/html to serve Let's Encrypt temporary files
  <Location "/.well-known/acme-challenge">
    ProxyPass !
  </Location>

  <IfFile /etc/letsencrypt/live/example.com/cert.pem>
    SSLEngine on
    SSLCertificateFile      /etc/letsencrypt/live/example.com/cert.pem
    SSLCertificateKeyFile   /etc/letsencrypt/live/example.com/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
  </IfFile>

</virtualhost>

<VirtualHost *:80>
  ServerName example.com

  Redirect / https://example.com/
</VirtualHost>

然后啟用它並頒發您的證書:

letsencrypt certonly --domain example.com --webroot --webroot-path /var/www/html

但是從上面的指南中可以更好地解釋這一點。

目前該指南不涵蓋nginx但其他答案可能會給出使用該技術的類似實際示例以及apache2 使用像apache2nginx這樣的前端網絡服務器的好處是您不必接觸 Icecast。 此外,它允許在您現有的網站(如果有)中提供 Icecast2。


其他答案可能想談談 Icecast2 與 Let's Encrypt 的本機接口。 目前我只能分享apache2方法,這是我多年來在生產中使用的方法,沒有任何問題。 此外,由於我使用 Debian GNU/Linux,我的 package 沒有 SSL 支持。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM