### HTTP/3 and QUIC Configuration Example Source: https://angie.software/adc/docs/configuration_lb/reference/http/http_v3 Example configuration for enabling HTTP/3 and QUIC on a server, including SSL/TLS setup and logging. ```APIDOC ## HTTP/3 and QUIC Configuration Example ### Description This example demonstrates how to configure Nginx to support HTTP/3 and QUIC. It includes setting up SSL certificates, listening on specific ports for both HTTP/2 and QUIC, and defining a custom log format. ### Method N/A (Configuration file) ### Endpoint N/A (Configuration file) ### Parameters N/A ### Request Example ```nginx http { log_format quic '$remote_addr - $remote_user [$time_local] '; '"$request" $status $body_bytes_sent '; '"$http_referer" "$http_user_agent" "$http3"'; access_log logs/access.log quic; server { listen 8443 quic reuseport; listen 8443 ssl; ssl_certificate certs/example.com.crt; ssl_certificate_key certs/example.com.key; location / { add_header Alt-Svc 'h3=":8443"; ma=86400'; } } } ``` ### Response N/A (Configuration applies to server behavior) ### Notes - For better compatibility, it is recommended to use the same port for HTTP/3 and HTTPS. - To accept HTTP/3 connections over TLS, TLSv1.3 support (OpenSSL 1.1.1+) is required. - The `reuseport` option can only be specified in one `listen ... quic` directive per server. Other `listen ... quic` directives should not include it. ``` -------------------------------- ### Cloud-Init Meta-Data Example Source: https://angie.software/adc/docs/install/cloud-init/install-qcow2-0.5 Example configuration for the meta-data file used in cloud-init ISO images. It specifies the instance ID and local hostname for the virtual machine. ```yaml instance-id: my-adc1 # уникальный идентификатор виртуальной машины local-hostname: my-server # имя хоста виртуальной машины ``` -------------------------------- ### Install QEMU on Ubuntu/Debian Source: https://angie.software/adc/docs/install/install-qcow2 Installs QEMU and necessary KVM/libvirt components on Ubuntu and Debian systems using the APT package manager. This setup is required for virtual machine management and deployment. ```bash sudo apt update sudo apt install -y \ qemu-kvm qemu-system-x86 qemu-utils \ libvirt-daemon-system libvirt-clients virtinst virt-manager \ ovmf cpu-checker ``` -------------------------------- ### Install QEMU on Fedora Source: https://angie.software/adc/docs/install/cloud-init/install-qcow2-0.5 Installs necessary QEMU and libvirt packages on Fedora systems using the DNF package manager. This includes utilities for virtualization management. ```bash $ sudo dnf install qemu libvirt libguestfs-tools libguestfs virt-viewer virt-install ``` -------------------------------- ### Install QEMU on Ubuntu/Debian Source: https://angie.software/adc/docs/install/cloud-init/install-qcow2-0.5 Installs QEMU, libvirt, and related tools on Ubuntu and Debian systems using the APT package manager. Ensures all required components for KVM virtualization are present. ```bash $ sudo apt update $ sudo apt install -y \ qemu-kvm qemu-system-x86 qemu-utils \ libvirt-daemon-system libvirt-clients virtinst virt-manager \ ovmf cpu-checker ``` -------------------------------- ### MP4 Pseudo-Streaming URL Example Source: https://angie.software/adc/docs/configuration_lb/reference/http/http_mp4 Demonstrates a typical URL format for requesting an MP4 file with pseudo-streaming enabled, specifying a start time. This allows players to initiate playback from a specific point in the file. ```http http://example.com/elephants_dream.mp4?start=238.88 ``` -------------------------------- ### Install QEMU on Fedora Source: https://angie.software/adc/docs/install/install-qcow2 Installs QEMU and related virtualization utilities on Fedora systems using the DNF package manager. This is a prerequisite for deploying virtual machine images like qcow2. ```bash sudo dnf install qemu libvirt libguestfs-tools libguestfs virt-viewer virt-install ``` -------------------------------- ### Listen Directive Syntax and Examples (Angie) Source: https://angie.software/adc/docs/configuration_lb/reference/http/http This snippet details the various syntaxes for the 'listen' directive in Angie, including IP addresses, hostnames, ports, and UNIX domain sockets. It also provides examples of how to specify addresses and ports, along with IPv6 and UNIX socket formats. ```nginx listen 127.0.0.1:8000; listen 127.0.0.1; listen 8000; listen *:8000; listen localhost:8000; listen [::]:8000; listen [::1]; listen unix:/var/run/angie.sock; ``` -------------------------------- ### Cloud-Init User-Data Example Source: https://angie.software/adc/docs/install/cloud-init/install-qcow2-0.5 Basic structure for the user-data file in a cloud-init ISO image. The content is minimal, primarily serving as a placeholder. ```yaml #cloud-config {} ``` -------------------------------- ### Nginx Proxy Configuration Example for Storing Images Source: https://angie.software/adc/docs/configuration_lb/reference/http/http_proxy An example Nginx configuration demonstrating how to store proxied images locally using proxy_store, proxy_store_access, and proxy_temp_path directives. It includes error page handling for fetching missing images. ```nginx location /images/ { root /data/www; error_page 404 = /fetch$uri; } location /fetch/ { internal; proxy_pass http://backend/; proxy_store on; proxy_store_access user:rw group:rw all:r; proxy_temp_path /data/temp; alias /data/www/; } ``` -------------------------------- ### Nginx try_files Directive Examples Source: https://angie.software/adc/docs/configuration_lb/reference/http/http Demonstrates the use of the try_files directive in Nginx to check for file existence and serve the first found file, or fall back to a URI or error code. Includes examples for serving images, handling 404 errors, and integrating with PHP, Drupal, WordPress, and Joomla. ```nginx location /images/ { try_files $uri /images/default.gif; } location = /images/default.gif { expires 30s; } ``` ```nginx location / { try_files $uri $uri/index.html $uri.html =404; } ``` ```nginx location / { error_page 404 = @drupal; log_not_found off; } ``` ```nginx location ~ \.php$ { try_files $uri @drupal; fastcgi_pass ...; fastcgi_param SCRIPT_FILENAME /path/to$fastcgi_script_name; # ... } ``` ```nginx location / { try_files /system/maintenance.html $uri $uri/index.html $uri.html @mongrel; } location @mongrel { proxy_pass http://mongrel; } ``` ```nginx location / { error_page 404 = @drupal; } location ~ \.php$ { try_files $uri @drupal; fastcgi_pass ...; fastcgi_param SCRIPT_FILENAME /path/to$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param QUERY_STRING $args; # ... прочие fastcgi_param } location @drupal { fastcgi_pass ...; fastcgi_param SCRIPT_FILENAME /path/to/index.php; fastcgi_param SCRIPT_NAME /index.php; fastcgi_param QUERY_STRING q=$uri&$args; # ... прочие fastcgi_param } ``` ```nginx location / { error_page 404 = @wordpress; } location ~ \.php$ { try_files $uri @wordpress; fastcgi_pass ...; fastcgi_param SCRIPT_FILENAME /path/to$fastcgi_script_name; # ... прочие fastcgi_param } location @wordpress { fastcgi_pass ...; fastcgi_param SCRIPT_FILENAME /path/to/index.php; # ... прочие fastcgi_param } ``` -------------------------------- ### Angie ADC 'groups' Configuration Example Source: https://angie.software/adc/docs/gslb/reference This example demonstrates how to define server groups using the 'groups' directive in Angie ADC configuration. It shows how to create a 'www' group containing individual servers and another group 'www3' that includes individual servers and the previously defined 'www' group. This facilitates reuse of server configurations across different contexts. ```yaml groups: www: members: - server: www1 - server: www2 www3: members: - server: www4 - server: www5 - group: www ``` -------------------------------- ### Example Upstream Configuration Source: https://angie.software/adc/docs/configuration_lb/reference/http/http_api This is an example of an 'upstream' block in Angie configuration. It defines a backend server group with a shared memory zone and lists specific servers with their resolution and service discovery details. ```nginx upstream backend { server backend.example.com service=_http._tcp resolve; server 127.0.0.1; zone backend 1m; } ``` -------------------------------- ### Angie ADC Mail Module Configuration Example Source: https://angie.software/adc/docs/configuration_lb/reference/mail/mail This example demonstrates a basic configuration for the Angie ADC mail module, setting up worker processes, logging, event handling, and defining mail server blocks for SMTP, POP3, and IMAP protocols. It includes authentication methods and capabilities for each protocol. ```nginx worker_processes auto; error_log /var/log/angie/error.log info; events { worker_connections 1024; } mail { server_name mail.example.com; auth_http localhost:9000/cgi-bin/auth.cgi; imap_capabilities IMAP4rev1 UIDPLUS IDLE LITERAL+ QUOTA; pop3_auth plain apop cram-md5; pop3_capabilities LAST TOP USER PIPELINING UIDL; smtp_auth login plain cram-md5; smtp_capabilities "SIZE 10485760" ENHANCEDSTATUSCODES 8BITMIME DSN; xclient off; server { listen 25; protocol smtp; } server { listen 110; protocol pop3; proxy_pass_error_message on; } server { listen 143; protocol imap; } server { listen 587; protocol smtp; } } ``` -------------------------------- ### Example Remote Storage HTTP Response Source: https://angie.software/adc/docs/configuration_lb/reference/stream/stream_upstream This example shows a typical HTTP response from a remote storage service. A 200 OK status with specific headers like 'X-Sticky-Sid' and 'X-Session-Info' is used to confirm server selection and provide session details. ```http HTTP/1.1 200 OK ... X-Sticky-Sid: backend-01 X-Session-Info: active ``` -------------------------------- ### HTTP/3 and QUIC Server Configuration Example Source: https://angie.software/adc/docs/configuration_lb/reference/http/http_v3 This example demonstrates how to configure an Nginx server block to support HTTP/3 over QUIC and TLS. It includes settings for the access log format, listen directives for both QUIC and SSL, certificate paths, and enabling the Alt-Svc header for HTTP/3 advertisement. Requires OpenSSL 1.1.1+ for TLSv1.3. ```nginx http { log_format quic '$remote_addr - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent ' '"$http_referer" "$http_user_agent" "$http3"'; access_log logs/access.log quic; server { # для лучшей совместимости рекомендуется # использовать одинаковый порт для http/3 и https listen 8443 quic reuseport; listen 8443 ssl; ssl_certificate certs/example.com.crt; ssl_certificate_key certs/example.com.key; location / { # используется для объявления о поддержке http/3 add_header Alt-Svc 'h3=":8443"; ma=86400'; } } } ``` -------------------------------- ### split_clients Directive Example (Nginx Configuration) Source: https://angie.software/adc/docs/configuration_lb/reference/http/http_split_clients This example demonstrates the usage of the split_clients directive to distribute clients based on the hashed value of a string. It defines buckets for '.one', '.two', and a default empty string, with specified percentage allocations. ```nginx split_clients "${remote_addr}AAA" $variant { 0.5% .one; 2.0% .two; * ""; } ``` -------------------------------- ### Deploy Angie ADC VM with virt-install Source: https://angie.software/adc/docs/install/cloud-init/install-qcow2-0.5 Launches a KVM virtual machine for Angie ADC using virt-install. It configures RAM, vCPUs, disk image, the cloud-init ISO as a CD-ROM, network bridge, and graphics settings. ```bash virt-install \ --virt-type kvm \ --name adc \ --ram 2048 \ --vcpus 2 \ --disk angie-adc-0.5.2-x86_64.cloud-init.qcow2,format=qcow2 \ --disk seed.iso,device=cdrom \ --network=bridge:virbr0 \ --graphics vnc,listen=0.0.0.0 \ --os-variant=centos8 \ --import ``` -------------------------------- ### Limit HTTP Methods within a Location (Nginx) Source: https://angie.software/adc/docs/configuration_lb/reference/http/http The `limit_except` directive restricts the HTTP methods that are allowed within a specific location block. Methods like `GET`, `POST`, `PUT`, etc., can be specified. If `GET` is allowed, `HEAD` is implicitly allowed. Other access restrictions can be managed using `allow` and `deny` directives or authentication modules. The example shows restricting access to all methods except GET and HEAD. ```nginx location / { limit_except GET { allow 192.168.1.0/32; deny all; } } ``` -------------------------------- ### DNS Configuration for ACME Challenge Source: https://angie.software/adc/docs/configuration_lb/reference/acme Example DNS records required to delegate DNS resolution for the `_acme-challenge.` subdomain to a specific nameserver. This setup is necessary for ACME DNS-01 validation. ```dns _acme-challenge.example.com. 60 IN NS ns.example.com. ns.example.com. 60 IN A 93.184.215.14 ``` -------------------------------- ### Get TLV data from PROXY protocol header Source: https://angie.software/adc/docs/configuration_lb/reference/stream/stream Retrieves TLV (Tag-Length-Value) data from the PROXY protocol header. The name can be a TLV type name or its numeric value (hexadecimal, starting with 0x). SSL TLVs are also supported with names starting with 'ssl_'. The PROXY protocol must be enabled. This is a built-in variable available in the stream context. ```nginx $proxy_protocol_tlv_ ``` -------------------------------- ### Nginx HTTP Server Configuration with API Location Source: https://angie.software/adc/docs/configuration_lb/reference/http/http_api Example Nginx HTTP server configuration that includes a location block for the '/config/' API. This setup restricts access to the API to localhost. ```nginx http { # ... upstream backend { zone upstream 256k; server backend.example.com resolve max_conns=5; # ... } server { # ... location /config/ { api /config/; allow 127.0.0.1; deny all; } } } ``` -------------------------------- ### Create Cloud-Init ISO Image Source: https://angie.software/adc/docs/install/cloud-init/install-qcow2-0.5 Generates a bootable ISO image named 'seed.iso' containing the prepared 'meta-data', 'user-data', and 'network-config' files. This ISO is used by cloud-init for VM initialization. ```bash genisoimage -output seed.iso -volid cidata -joliet -rock meta-data user-data network-config ``` -------------------------------- ### Example: Listing Available Certificates and Keys Source: https://angie.software/adc/docs/management/cli-commands Shows the output of the `list` command in the `cert-config` context, which displays available certificate and key files and their validation status. ```cli (cert-config)$$ list cp.crt : invalid cp.key : invalid site1.crt: certificate site1.key: key ``` -------------------------------- ### TCP/UDP Upstream Probe Configuration Example Source: https://angie.software/adc/docs/configuration_lb/health-probes This example shows how to configure a TCP/UDP upstream probe. It details the setup for upstream servers, a map for probe response checking, and the `upstream_probe` directive with parameters for port, interval, test condition, essentiality, persistence, failure/success counts, max response size, mode, and send data. It also notes the requirement for CRLF separators in HTTP headers. ```nginx upstream backend { zone backend 1m; server a.example.com; server b.example.com; } map $upstream_probe_response $good { ~200 "1"; default ""; } server { listen ...; # ... proxy_pass backend; upstream_probe_timeout 1s; upstream_probe backend_probe port=12345 interval=5s test=$good essential persistent max_response=512k mode=onfail "send=data:GET / HTTP/1.0\r\n\r\n"; } ``` -------------------------------- ### Example: Matching Certificate and Key Files Source: https://angie.software/adc/docs/management/cli-commands Illustrates the usage of the `match` command to verify if a given certificate file and key file are a valid pair. It shows successful and unsuccessful matching scenarios. ```cli (cert-config)$$ match site1.crt site1.key Certificate and key match (cert-config)$$ match site1.crt site2.key Certificate and key DO NOT match (cert-config)$$ ``` -------------------------------- ### Certbot Nginx Configuration Example Source: https://angie.software/adc/docs/configuration_lb/reference/acme An example of a typical Nginx server block configuration generated by certbot for handling HTTP and HTTPS traffic, including SSL certificate paths. ```nginx server { listen 80; server_name example.com www.example.com; return 301 https://$host$request_uri; } server { listen 443 ssl; server_name example.com www.example.com; root /var/www/example; index index.html; ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; include /etc/letsencrypt/options-ssl-nginx.conf; ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; } ``` -------------------------------- ### Nginx Location Matching Examples Source: https://angie.software/adc/docs/configuration_lb/reference/http/http Demonstrates various ways to define Nginx 'location' blocks using prefix strings, exact matches, regular expressions, and named locations. It illustrates how different request URIs are matched to specific configurations. ```nginx location =/ { #конфигурация А } location / { #конфигурация Б } location /documents/ { #конфигурация В } location ^~/images/ { #конфигурация Г } location ~*\.(gif|jpg|jpeg)$ { #конфигурация Д } ``` ```nginx location /user/ { proxy_pass http://user.example.com; } location =/user { proxy_pass http://login.example.com; } ``` -------------------------------- ### Проверка состояния виртуальной сети Source: https://angie.software/adc/docs/install/install-qcow2 Команда для проверки списка активных виртуальных сетей libvirt. Используется для диагностики сетевых проблем перед развертыванием. ```bash sudo virsh net-list --all ``` -------------------------------- ### Convert HEAD to GET for Caching (Nginx Configuration) Source: https://angie.software/adc/docs/configuration_lb/reference/http/http_proxy Enables or disables the conversion of the 'HEAD' method to 'GET' for caching purposes. If disabled, the cache key must include the $request_method variable. ```nginx proxy_cache_convert_head on; ``` -------------------------------- ### ICMP Echo Request Probe Configuration Example Source: https://angie.software/adc/docs/configuration_lb/health-probes This example illustrates using ICMP Echo requests for upstream probing instead of traditional HTTP requests. It configures an upstream block with server IP addresses and then uses the `upstream_probe` directive with the `ping` option. The example highlights how ICMP checks availability of the IP address, ignoring ports, and specifies different timeout values for probe responses. ```nginx http { upstream u { zone z 1k; server 127.0.0.1:8081; server 127.0.0.1:8082; } server { listen ...; location / { proxy_pass http://u/; upstream_probe simple1 interval=3s ping; upstream_probe simple2 interval=3s ping ping_timeout=3s; } } } ``` -------------------------------- ### Configuring Listen Socket Options (Angie) Source: https://angie.software/adc/docs/configuration_lb/reference/http/http Demonstrates the use of optional parameters within the 'listen' directive to control socket behavior. This includes setting default servers, enabling SSL, HTTP/2, QUIC, and proxy protocol, as well as fine-tuning socket parameters. ```nginx listen 80 default_server ssl http2; listen 443 ssl spdy; listen 9000 quic reuseport; listen 10000 proxy_protocol; listen 10001 backlog=1024; listen 10002 rcvbuf=128k sndbuf=128k; listen 10003 accept_filter=dataready; listen 10004 deferred; listen 10005 reuseport so_keepalive=on; listen 10006 ipv6only=on; ``` -------------------------------- ### Nginx Upstream Configuration Example Source: https://angie.software/adc/docs/configuration_lb/reference/http/http_api An example of Nginx stream upstream configuration, defining a 'backend' upstream with multiple servers and a 'zone' for shared memory. This configuration is relevant for the API endpoints described. ```nginx upstream backend { server backend.example.com:8080 service=_example._tcp resolve; server 127.0.0.1:12345; zone backend 1m; } upstream backend { zone backend 256k; server backend.example.com resolve max_conns=5; random; } ``` -------------------------------- ### Prometheus Configuration Example Source: https://angie.software/adc/docs/configuration_lb/reference/http/http_prometheus This snippet shows how to include Prometheus configuration and define a server block with a location that exposes metrics in Prometheus format. It assumes `prometheus_all.conf` is included and sets up a listener on port 80 for the `/p8s` path. ```nginx http { include prometheus_all.conf; # ... server { listen 80; location =/p8s { prometheus all; } # ... } } ``` -------------------------------- ### MP4 Pseudo-Streaming with Start and End Times Source: https://angie.software/adc/docs/configuration_lb/reference/http/http_mp4 Illustrates how to use both 'start' and 'end' query parameters to define a specific playback range for an MP4 file. This enables clients to request a segment of the video. ```http http://example.com/elephants_dream.mp4?start=238.88&end=555.55 ``` -------------------------------- ### Развертывание Angie ADC ВМ Source: https://angie.software/adc/docs/install/install-qcow2 Команды для перемещения образа Angie ADC и запуска виртуальной машины с помощью virt-install. Требует наличия образа qcow2 и указания параметров ВМ. ```bash sudo mv angie-adc-0.6.0-x86_64.cloud-init.qcow2 /var/lib/libvirt/images/ sudo virt-install --name angie-adc-0.6.0 --ram 2048 --disk /var/lib/libvirt/images/angie-adc-0.6.0-x86_64.cloud-init.qcow2 --os-variant generic --import ``` -------------------------------- ### Example: Displaying Certificate Information Source: https://angie.software/adc/docs/management/cli-commands Demonstrates how to view detailed information about a traffic certificate named 'site1.crt' using the `info` command within the `cert-config` context. ```cli (cert-config)$$ info traffic name site1.crt Certificate: Data: Version: 3 (0x2) Serial Number: 1 (0x1) Signature Algorithm: sha1WithRSAEncryption Issuer: C = RU, ST = Moscow, O = Angie, OU = EVO, CN = Root CA Validity Not Before: Feb 18 12:23:08 2025 GMT Not After : Feb 18 12:23:08 2027 GMT Subject: CN = Demo Certificate, ST = Moscow, C = RU, O = Angie, OU = EVO Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (4096 bit) Modulus: ... (cert-config)$$ ``` -------------------------------- ### Stream Limit Conn Configuration Example Source: https://angie.software/adc/docs/monitoring-and-statistics/console-light This example demonstrates the configuration of `limit_conn_zone` and `limit_conn` directives within the `stream` context for controlling connection limits. It requires `status_zone` and `limit_conn` directives in the `server` context, and `limit_conn_zone` in the `stream` context. ```nginx stream { # ... limit_conn_zone $connection zone=limit-conn-stream:10m; server { # ... limit_conn limit-conn-stream 1; status_zone foo; } } ``` -------------------------------- ### Add User to Libvirt and KVM Groups Source: https://angie.software/adc/docs/install/cloud-init/install-qcow2-0.5 Adds the current user to the 'libvirt' and 'kvm' groups to grant necessary permissions for managing virtual machines. This is a crucial step after installing virtualization software. ```bash $ sudo usermod -aG libvirt USER $ sudo usermod -aG kvm USER ``` -------------------------------- ### Geo Module Configuration Example Source: https://angie.software/adc/docs/configuration_lb/reference/http/http_geo The geo module creates variables whose values depend on the client's IP address. This example demonstrates how to define IP address ranges and assign values to a variable named $geo. ```nginx geo $geo { default 0; 127.0.0.1 2; 192.168.1.0/24 1; 10.1.0.0/16 1; ::1 2; 2001:0db8::/32 1; } ``` -------------------------------- ### Get Stream Upstream Server Configuration Source: https://angie.software/adc/docs/configuration_lb/reference/http/http_api Retrieves configuration for a specific server within a stream upstream. Supports fetching individual parameters or the entire server configuration. The `defaults=on` argument can be used to get default parameter values. ```bash $ curl http://127.0.0.1/config/http/upstreams/backend/servers/backend.example.com/max_conns $ curl http://127.0.0.1/config/http/upstreams/backend/servers/backend.example.com $ curl http://127.0.0.1/config/http/upstreams/backend/servers $ curl http://127.0.0.1/config/http/upstreams/backend/servers?defaults=on ``` -------------------------------- ### Basic HTTP Load Balancing with Round-Robin (Angie ADC) Source: https://angie.software/adc/docs/configuration_lb/lb-methods This example demonstrates the simplest HTTP load balancing configuration using Angie ADC. It sets up an upstream group 'myapp1' with three servers and distributes incoming requests on port 80 using the default round-robin method. ```nginx http { upstream myapp1 { server srv1.example.com; server srv2.example.com; server srv3.example.com; } server { listen 80; location / { proxy_pass http://myapp1; } } } ``` -------------------------------- ### Add User to Libvirt and KVM Groups Source: https://angie.software/adc/docs/install/install-qcow2 Adds the current user to the 'libvirt' and 'kvm' groups, granting them necessary permissions to manage virtual machines and interact with QEMU/KVM. Replace 'USER' with your actual username. ```bash sudo usermod -aG libvirt USER sudo usermod -aG kvm USER ``` -------------------------------- ### Configure network-config for OVA with E1000 driver (cloud-init) Source: https://angie.software/adc/docs/install/cloud-init/install-cloud-init This snippet demonstrates how to configure static IP addresses, gateways, and DNS settings for multiple network interfaces (ens33, ens37, ens38) on an OVA image using cloud-init. It assumes the E1000 network driver. If DHCP is used, the network-config file can be left empty. ```yaml #cloud-config network: version: 2 ethernets: ens33: dhcp4: false addresses: - 192.168.100.155/24 gateway4: 192.168.100.1 nameservers: addresses: [8.8.8.8, 1.1.1.1] search: [example.com] ens37: dhcp4: false addresses: - 192.168.110.155/24 gateway4: 192.168.110.1 nameservers: addresses: [8.8.8.8, 1.1.1.1] search: [example.com] ens38: dhcp4: false addresses: - 192.168.120.155/24 gateway4: 192.168.120.1 nameservers: addresses: [8.8.8.8, 1.1.1.1] search: [example.com] ``` -------------------------------- ### Define Character Set Mapping Table (Nginx/Angie Config) Source: https://angie.software/adc/docs/configuration_lb/reference/http/http_charset The `charset_map` directive describes a conversion table from one character set to another. Character codes are specified in hexadecimal. The example shows mapping from `koi8-r` to `windows-1251` and `utf-8`, with provided example files for full transformations. ```nginx charset_map koi8-r windows-1251 { C0 FE ; C1 E0 ; C2 E1 ; C3 F6 ; } charset_map koi8-r utf-8 { C0 D18E ; C1 D0B0 ; C2 D0B1 ; C3 D186 ; } ``` -------------------------------- ### Configure Access Logging with Buffering and Gzip Compression Source: https://angie.software/adc/docs/configuration_lb/reference/http/http_log This example demonstrates configuring the access_log directive to write to a compressed log file with buffering and a flush interval. It requires the zlib library for gzip support and specifies the log path, format, gzip compression level, and flush time. ```nginx access_log /path/to/log.gz combined gzip flush=5m; ``` -------------------------------- ### Angie ADC Configuration File Structure Source: https://angie.software/adc/docs/configuration_lb/reference/configfile Demonstrates the hierarchical structure of an Angie ADC configuration file, including the main, events, http, and stream contexts, as well as server and location blocks within the http context. It also shows example directives. ```nginx user angie; # директива в контексте 'main' events { # конфигурация обработки соединений } http { # Конфигурация трафика HTTP, для всех вложенных виртуальных серверов server { # конфигурация виртуального HTTP сервера 1 location /one { # конфигурация обработки HTTP запросов с URI, начинающимися с '/one' } location /two { # конфигурация обработки HTTP запросов с URI, начинающимися с '/two' } } server { # конфигурация виртуального HTTP сервера 2 } } stream { # Конфигурация трафика TCP/UDP, для всех вложенных виртуальных серверов server { # конфигурация виртуального TCP сервера 1 } } ``` -------------------------------- ### Get hostname Source: https://angie.software/adc/docs/configuration_lb/reference/stream/stream Represents the hostname. This is a built-in variable available in the stream context. ```nginx $hostname ``` -------------------------------- ### Configure Server Names with Wildcards and Regex - Nginx Source: https://angie.software/adc/docs/configuration_lb/reference/stream/stream This snippet demonstrates configuring server names using exact matches, wildcards (*), and regular expressions (~) in Nginx. It covers basic server name definition, wildcard usage for subdomains and partial matches, and regex for complex pattern matching, including named capture groups. ```nginx server { listen 443 ssl; server_name example.com www.example.com; ssl_certificate /etc/angie/cert.pem; ssl_certificate_key /etc/angie/key.pem; } server { server_name example.com *.example.com www.example.*; } server { server_name www.example.com ~^www\d+\.example\.com$; } server { server_name ~^(www\.)?(.+)$; proxy_pass www.$2:12345; } server { server_name ~^(www\.)?(?.+)$; proxy_pass www.$domain:12345; } ``` -------------------------------- ### Get Angie version Source: https://angie.software/adc/docs/configuration_lb/reference/stream/stream Represents the version of Angie. This is a built-in variable available in the stream context. ```nginx $angie_version ``` -------------------------------- ### Geo Module Syntax and Basic Usage Source: https://angie.software/adc/docs/configuration_lb/reference/http/http_geo Demonstrates the fundamental syntax of the 'geo' module, including how to specify an address source and a variable to store the result. It also shows how to reference external configuration files. ```nginx geo $arg_remote_addr $geo { ... } ``` ```nginx geo $country { default ZZ; include conf/geo.conf; delete 127.0.0.0/16; proxy 192.168.100.0/24; proxy 2001:0db8::/32; 127.0.0.0/24 US; 127.0.0.1/32 RU; 10.1.0.0/16 RU; 192.168.1.0/24 UK; } ``` ```nginx 10.2.0.0/16 RU; 192.168.2.0/24 RU; ``` -------------------------------- ### Configure FLV Module for Pseudo-Streaming Source: https://angie.software/adc/docs/configuration_lb/reference/http/http_flv Enables server-side support for pseudo-streaming of Flash Video (FLV) files. It handles requests with a 'start' argument by sending file content from the specified byte offset, prepended with an FLV header. The module needs to be compiled with `--with-http_flv_module` or is included in pre-built packages. ```nginx location ~ \.flv$ { flv; } ``` -------------------------------- ### Get client port Source: https://angie.software/adc/docs/configuration_lb/reference/stream/stream Represents the client's port. This is a built-in variable available in the stream context. ```nginx $remote_port ```