How to Install, Configure, and Run Envoy as a Front‑End Proxy on Ubuntu
This guide walks you through installing the Envoy proxy on Ubuntu, creating a YAML configuration with listeners, filters, clusters, and routes, running the service, and testing it with curl and a simple Python HTTP server to verify traffic forwarding.
Introduction
Envoy is an open‑source, high‑performance, extensible proxy originally developed by Lyft. It is designed for modern micro‑service architectures, offering load balancing, service discovery, routing, authentication, and authorization. Envoy is widely used to build and deploy cloud‑native applications.
Environment
Ubuntu 22.04.3 LTS Desktop 64‑bit
1 Installation
Downloading the pre‑compiled binary is the simplest method on Linux. From the Envoy GitHub releases page, download the latest Ubuntu binary (e.g., envoy-1.28.0-linux-x86_64). https://github.com/envoyproxy/envoy/releases Rename and make it executable:
# Rename for easier command entry
sudo mv envoy-1.28.0-linux-x86_64 envoy
# Add execute permission
chmod +x envoyVerify the installation:
./envoy --version2 Configuration
Configuration follows the official documentation. Envoy can be configured statically (YAML files) or dynamically. The main sections are:
listeners : define network addresses and protocols.
filters : processing chain for incoming connections (e.g., HTTP connection manager).
clusters : define upstream services for load balancing.
routes : map requests to clusters.
admin : management interface for statistics and diagnostics.
Example snippets:
listeners:
- name: listener_0
address:
socket_address: { protocol: TCP, address: 0.0.0.0, port_value: 10000 }
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
codec_type: auto
stat_prefix: http
route_config:
name: local_route
virtual_hosts:
- name: backend
domains: ["*"]
routes:
- match: { prefix: "/" }
route: { cluster: baidu }
http_filters:
- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router clusters:
- name: baidu
connect_timeout: 1s
type: STRICT_DNS
dns_lookup_family: V4_ONLY
lb_policy: round_robin
load_assignment:
cluster_name: baidu
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: www.baidu.com
port_value: 80 admin:
access_log_path: /home/zhg/Mine/Workplace/getenvoy/envoy.log
address:
socket_address:
address: 0.0.0.0
port_value: 100013 Running Envoy
After creating envoy_conf.yaml, start Envoy with: ./envoy -c envoy_conf.yaml -l debug Use envoy --help for additional options.
4 Testing
4.1 Admin Interface
Open a browser at http://localhost:10001 to view the admin page.
4.2 Proxy Verification with curl
curl -vvv baidu.comThe response shows a successful HTTP 200 from Baidu. curl -v -H 'Host: baidu.com' 127.0.0.1:10000 The response header contains server: envoy, confirming the request passed through Envoy.
4.3 Proxying to a Local Web Service
Add a new cluster named localserver and point the route to it:
clusters:
- name: localserver
connect_timeout: 1s
type: STATIC
dns_lookup_family: V4_ONLY
lb_policy: round_robin
load_assignment:
cluster_name: localserver
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 127.0.0.1
port_value: 9001 routes:
- match: { prefix: "/" }
route: { cluster: localserver }Create a simple HTML page ( web/index.html) and start a Python HTTP server:
# Serve on port 9001
python3 -m http.server 9001Access http://<em>your‑ubuntu‑ip</em>:10000/ in a browser; the page served by the local Python server should appear, confirming that Envoy correctly forwards traffic.
Reference
www.envoyproxy.io/docs/envoy/…
Original article: https://juejin.cn/post/7321410883875143730 (© original author)
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
