五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Nginx No, Traefik Yes

2023-08-21 08:51 作者:Newbe36524  | 我要投稿

As we all know, Nginx is a very popular reverse proxy server. It is very stable and has a lot of features. But I choose Traefik instead of Nginx as a reverse proxy in test environment since it is more suitable for my use case. In this post, I will explain why I choose Traefik instead of Nginx.

Background

I have a test environment which is running on a single server. It has a lot of services running on it. I want to expose these services to the internet. So I need a reverse proxy server to do this. I am used to using Swag as a reverse proxy for years, witch is based on Nginx. But it is a little bit hard to configure. So I want to find a better solution.

I want to find a reverse proxy server which meets the following requirements:

  1. It should be containerized. I don't want to install it on the host machine.

  2. It should be easy to configure.

  3. It should support Let's Encrypt to generate SSL certificates automatically.

  4. It should be easy to migrate to production environment if needed.

Swag

Swag1 is a reverse proxy server based on Nginx, witch I used for years. It meets all the requirements above. Swag project provides a docker image to run it. And dozens of Nginx configuration template files for developers to use. If you are familiar with Nginx, you can easily configure it. But it is way too complex for beginners.

I choose Swag as my reverse proxy server instead of bare Nginx, because it supports Let's Encrypt to generate SSL automatically by adding a few lines of configuration. It is very convenient.

Caddy

Caddy2 is a web server written in Go. I tried this solution to solve my problem after doing some research.

For example, if you want to expose a service running on port 80, you just need to create a file named Caddyfile:

Bilibili 代碼塊無法正常渲染,因此無法正常顯示。請關注微信公眾號“newbe技術專欄”,搜索對應文章代碼內(nèi)容。

Then run Caddy with docker as following docker-compose file:

Bilibili 代碼塊無法正常渲染,因此無法正常顯示。請關注微信公眾號“newbe技術專欄”,搜索對應文章代碼內(nèi)容。

Then configure my DNS to point api.newbe.pro and ws.newbe.pro to my server with A record. Then I can access my api service and ws service with https://api.newbe.pro and https://ws.newbe.pro respectively.

I finally gave up this solution because Caddy does not support many build-in plugins as Traefik does. Of course, you can compile Caddy with plugins you need. But I don't want to do this.

Traefik

Traefik3 is also a reverse proxy server written in Go. I can run it as following docker-compose file:

Bilibili 代碼塊無法正常渲染,因此無法正常顯示。請關注微信公眾號“newbe技術專欄”,搜索對應文章代碼內(nèi)容。

You can notice that all the configuration is in docker-compose file. I don't need to create any other configuration file, it is very convenient. Traefik is not only support docker as a provider to automatically discover services, but also support Kubernetes if I want to migrate to Kubernetes in the future.

Conclusion

I choose Traefik instead of Nginx as a reverse proxy in test environment because it is more suitable for my use case. It is cloud native and easy to configure. I don't need to create any other configuration file. I can configure everything in docker-compose file.

References

  • Azure DNS Zone4

感謝您的閱讀,如果您覺得本文有用,快長按右下角大拇指??為本文點贊~

歡迎關注作者的微信公眾號“newbe技術專欄”,獲取更多技術內(nèi)容。

  • 本文作者: newbe36524

  • 本文鏈接: https://www.newbe.pro/Others/0x02A-Nginx-no-traefik-yes/

  • 版權聲明: 本博客所有文章除特別聲明外,均采用 BY-NC-SA 許可協(xié)議。轉(zhuǎn)載請注明出處!

  1. https://github.com/linuxserver/docker-swag?

  2. https://caddyserver.com/v2?

  3. https://doc.traefik.io/traefik/?

  4. https://learn.microsoft.com/azure/dns/dns-zones-records?WT.mc_id=DT-MVP-5004283?


Nginx No, Traefik Yes的評論 (共 條)

分享到微博請遵守國家法律
平定县| 罗定市| 乡宁县| 娱乐| 东莞市| 浑源县| 边坝县| 丽江市| 德化县| 松潘县| 通辽市| 双辽市| 昌乐县| 墨江| 临猗县| 定边县| 巨鹿县| 南陵县| 祁连县| 会宁县| 措美县| 红河县| 桂东县| 辉县市| 望城县| 龙江县| 新闻| 织金县| 泉州市| 定陶县| 兴安县| 浦县| 峨边| 贺州市| 扬州市| 南宫市| 英吉沙县| 阿鲁科尔沁旗| 莎车县| 永嘉县| 桂林市|