‍

Envoy proxy is a powerful service proxy designed for cloud-native applications. It offers high performance and flexibility, making it a popular choice for modern services and infrastructure. In this tutorial, we will guide you through the process of installing and configuring Envoy Proxy on a Debian 11 server.

Prerequisites

Before we begin, make sure you have the following prerequisites:

  • A Linux server running Debian 11 Bullseye
  • A non-root user with sudo privileges

Adding Envoy Repository

To install Envoy, we need to add the Envoy repository to our Debian system. Follow these steps to do so:

  1. Install the required packages gnupg2 and apt-transport-https by running the following command:
sudo apt install gnupg2 apt-transport-https -y
  1. Add and verify the Envoy GPG key by executing the command below:
curl -sL 'https://deb.dl.getenvoy.io/public/gpg.8115BA8E629CC074.key' | sudo gpg --dearmor -o /usr/share/keyrings/getenvoy-keyring.gpg
echo a077cb587a1b622e03aa4bf2f3689de14658a9497a9af2c427bba5f4cc3c4723 /usr/share/keyrings/getenvoy-keyring.gpg | sha256sum --check

If the key is valid, you will see the output message “OK”.

  1. Add the Envoy repository to your system by running the following command:
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/getenvoy-keyring.gpg] https://deb.dl.getenvoy.io/public/deb/debian $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/getenvoy.list
  1. Update and refresh your Debian repository:
sudo apt update

Installing Envoy Proxy

Now that we have added the Envoy repository, we can proceed with the installation of Envoy Proxy. Follow these steps to install Envoy:

  1. Run the following command to install the Envoy package on your Debian 11 system:
sudo apt install getenvoy-envoy
  1. Verify the installation by checking the Envoy version:
envoy --version

You should see the installed version of Envoy, which should be the latest one provided by the Envoy repository.

  1. Optionally, you can explore all available options for the envoy command by running:
envoy --help

This will display a list of options that you can use to configure Envoy.

Configuring Envoy Proxy

After installing Envoy, it’s time to configure it to suit your needs. Follow these steps to set up Envoy:

  1. Create a new directory /etc/envoy/ by running the following command:
sudo mkdir -p /etc/envoy/
  1. Use a text editor to create a new file /etc/envoy/demo.yaml:
sudo nano /etc/envoy/demo.yaml
  1. Add the following configuration to the demo.yaml file:
static_resources:
listeners:
- name: listener_0
address:
socket_address:
address: 0.0.0.0
port_value: 80
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
stat_prefix: ingress_http
access_log:
- name: envoy.access_loggers.stdout
typed_config:
"@type": type.googleapis.com/envoy.extensions.access_loggers.stream.v3.StdoutAccessLog
http_filters:
- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: ["*"]
routes:
- match:
prefix: "/"
route:
host_rewrite_literal: www.envoyproxy.io
cluster: service_envoyproxy_io
clusters:
- name: service_envoyproxy_io
type: LOGICAL_DNS
connect_timeout: 5s
dns_lookup_family: V4_ONLY
load_assignment:
cluster_name: service_envoyproxy_io
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: www.envoyproxy.io
port_value: 443
transport_socket:
name: envoy.transport_sockets.tls
typed_config:
"@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext
sni: www.envoyproxy.io
  1. Save and close the file.
  2. Validate the configuration file demo.yaml by running the following command:
envoy --mode validate -c /etc/envoy/demo.yaml

If your YAML configuration is correct, you will see the output “configuration /etc/envoy/demo.yaml OK”.

  1. Run Envoy with the configuration file demo.yaml using the following command:
envoy -c /etc/envoy/demo.yaml

Make sure there are no error messages in the log output.

  1. On your local machine, edit the /etc/hosts file using a text editor:
sudo nano /etc/hosts
  1. Add the following entry to map the domain name www.envoyproxy.io to your server’s IP address:
192.168.5.10 www.envoyproxy.io
  1. Save and close the file.
  2. Open your web browser and visit the domain name www.envoyproxy.io. You should now see the homepage of www.envoyproxy.io.

Congratulations! You have successfully installed and configured Envoy Proxy on your Debian 11 server. You can now use Envoy to proxy your website and enjoy its high-performance and flexible features.

Conclusion

In this tutorial, we have covered the installation and configuration of Envoy Proxy on a Debian 11 server. We started by adding the Envoy repository and installing the Envoy package. Then, we walked through the process of configuring Envoy using a YAML configuration file. Finally, we tested the configuration and accessed the website through the Envoy proxy.

Envoy Proxy is a powerful tool that enables efficient and scalable proxying for cloud-native applications. With its performance and flexibility, Envoy can enhance the reliability and security of your services. If you’re looking for a reliable cloud hosting provider to leverage the capabilities of Envoy Proxy, consider Shape.host. They offer Cloud VPS solutions that are optimized for performance and scalability. Shape.host empowers businesses with efficient and secure cloud hosting solutions.