Skip to content

Instantly share code, notes, and snippets.

  • Save pulipulichen/72d4e3133eacf6ffbc0dc051630b37e4 to your computer and use it in GitHub Desktop.
Save pulipulichen/72d4e3133eacf6ffbc0dc051630b37e4 to your computer and use it in GitHub Desktop.
Docker,NGINX,ReverseProxy
看看網頁版全文 ⇨ 用Docker建置具備HTTPS的NGINX反向代理伺服器:docker-HTTPS-Reverse-Proxy : Build a NGINX Reverse Proxy with HTTPS in Docker: docker-HTTPS-Reverse-Proxy
https://blog.pulipuli.info/2023/04/blog-post_10.html
直接設定NGINX實在是太複雜了,那我們用Docker把複雜的內容都包裝起來,只追求最簡單的設定即可。
----
# docker-HTTPS-Reverse-Proxy。
https://github.com/pulipulichen/docker-HTTPS-Reverse-Proxy。
docker-HTTPS-Reverse-Proxy是我為了將NGINX建置成理想的反向代理伺服器所開發的專案。
其主要的特點有:。
- 反向代理伺服器 (reverse proxy):在後端伺服器(backend)前面架設一層緩衝伺服器使用。
- 負載平衡 (loaidng balancing):如果設定多個後端伺服器,則流量會自動分配給它們使用。
- 自動快取與壓縮:大部分靜態資源,例如JavaScript、CSS、圖片、聲音與影片,都會被自動快取和壓縮。
- 隱藏伺服器資訊:Server、X-Powered-By等標頭會被自動移除。錯誤訊息的網頁也被簡化,讓人完全看不出這是什麼伺服器。
- 流量限制:避免DDoS攻擊。
- SSL憑證:分析後端伺服器的設定,使用certbot申請憑證並且安裝,每30天進行更新,一切全自動。
- 虛擬主機:根據域名判斷後端伺服器。
# 環境 / Environment
docker-HTTPS-Reverse-Proxy是以Docker為主。
下載檔案需要用到git。
部分腳本使用了只能在Linux運作的bash。
最難克服的應該只有Docker引擎的部分。
關於Docker的安裝,請看Install Docker Engine。
除了Docker引擎之外,還需要安裝docker-compose,詳細請看「Install the Compose standalone」。
# 使用方法 / Usage
首先我們要將docker-HTTPS-Reverse-Proxy用git複製到本地端:。
````
git clone https://github.com/pulipulichen/docker-HTTPS-Reverse-Proxy.git
````
再來是複製./conf/backends.sample.yml為./conf/backends.yml,然後修改它。
----
繼續閱讀 ⇨ 用Docker建置具備HTTPS的NGINX反向代理伺服器:docker-HTTPS-Reverse-Proxy : Build a NGINX Reverse Proxy with HTTPS in Docker: docker-HTTPS-Reverse-Proxy
https://blog.pulipuli.info/2023/04/blog-post_10.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment