Home > Operation and Maintenance > Nginx > The difference between traefik and nginx

The difference between traefik and nginx

(*-*)浩
Release: 2019-06-18 11:34:29
Original
20647 people have browsed it

Træfɪk is a modern HTTP reverse proxy and load balancing tool born to make the deployment of microservices more convenient. It supports multiple backends (Docker, Swarm, Kubernetes, Marathon, Mesos, Consul, Etcd, Zookeeper, BoltDB, Rest API, file...) to automatically and dynamically apply its configuration file settings.

The difference between traefik and nginx

Since the microservice architecture, Docker technology and kubernetes orchestration tools have only become popular in recent years, the initial reverse proxy servers such as nginx and apache were not No support is provided, after all, they are not prophets; That’s why the Ingress Controller appears to connect kubernetes and front-end load balancers such as nginx; that is, the existence of the Ingress Controller is to interact with kubernetes. Being able to write nginx configuration and reload it is a compromise;The recently emerged traefik inherently provides support for kubernetes, which means that traefik itself can interact with the kubernetes API and sense Backend changes, So you can know: When using traefik, the Ingress Controller is no longer useful!

Traefik, like nginx, is a reverse proxy tool. The reasons for using it are based on the following points

Beautiful dashboard interface

It can be configured based on the container label. It is simple to add new services. There is no need for complex configuration like nginx, and there is no need to restart frequently.

Integration of prometheus and k8s

The basic components of Traefik

There are only two components, it’s that simple and supports writing middle-ware by yourself.

Traefik
Traefik’s main program, you can specify the configuration file when starting,

Dashboard
A simple Dashboard, you can Look at the current routing rules and forwarding result statistics.

How to use configuration files

Traefik’s configuration is divided into two categories: static configuration and dynamic configuration.

Dynamic configuration: used to control routing and load balancing policies. Dynamic configuration can take effect without restarting Traefik.

Static configuration: To put it simply, except for dynamic configuration, everything else is in the category of static configuration. Static configuration needs to restart Traefik to take effect.

I won’t write detailed configuration instructions. It is wisest to go to the official website to find the configuration you need (I am a wise official website).
But the meaning of some configurations will be explained in the following exercises.

Notes

动态配置可以和静态配置一起在同一个文件里,动态配置写在文件的最后。
如果想用配置文件来指定路由规则的话,需要将动态配置和静态配置文件分开,如下
## 在  "静态配置的最后面"  加入下面信息来指定动态配置文件[file]watch = truefilename = "rules.toml"
Copy after login

For more Nginx related technical articles, please visit the Nginx Usage Tutorial column to learn!

The above is the detailed content of The difference between traefik and nginx. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template