### Query API Entities Source: https://pt.angie.software/angie/docs/configuration/modules/http/http_api Examples of using GET to retrieve configuration entities. ```console $ 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 ``` -------------------------------- ### Install Angie on Debian and Ubuntu Source: https://pt.angie.software/angie/docs/installation/oss_packages Standard repository setup and installation commands for Debian-based distributions. ```console $ sudo apt-get update $ sudo apt-get install -y ca-certificates curl ``` ```console $ sudo curl -o /etc/apt/trusted.gpg.d/angie-signing.gpg \ https://angie.software/keys/angie-signing.gpg ``` ```console $ echo "deb https://download.angie.software/angie/$(. /etc/os-release && echo "$ID/$VERSION_ID $VERSION_CODENAME") main" \ | sudo tee /etc/apt/sources.list.d/angie.list > /dev/null ``` -------------------------------- ### Copy ModSecurity configuration examples Source: https://pt.angie.software/angie/docs/installation/external-modules/modsecurity Prepare the necessary configuration files by copying the provided examples. ```console $ sudo cp coreruleset/crs-setup.conf.example coreruleset/crs-setup.conf $ sudo cp coreruleset/rules/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf.example \ coreruleset/rules/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf $ sudo cp coreruleset/rules/RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf.example \ coreruleset/rules/RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf ``` -------------------------------- ### Wordpress and Joomla configuration Source: https://pt.angie.software/angie/docs/configuration/modules/http Example setup for Wordpress or Joomla using try_files and named locations. ```nginx location / { error_page 404 = @wordpress; } location ~ \.php$ { try_files $uri @wordpress; fastcgi_pass ...; fastcgi_param SCRIPT_FILENAME /path/to$fastcgi_script_name; # ... outros fastcgi_param } location @wordpress { fastcgi_pass ...; fastcgi_param SCRIPT_FILENAME /path/to/index.php; # ... outros fastcgi_param } ``` -------------------------------- ### Drupal FastCGI configuration Source: https://pt.angie.software/angie/docs/configuration/modules/http Example setup for Drupal using try_files and named locations. ```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; # ... outros 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; # ... outros fastcgi_param } ``` -------------------------------- ### Install Prerequisites on OSNova Source: https://pt.angie.software/angie/docs/installation/pro_packages Install necessary tools to manage the Angie PRO repository. ```console $ sudo apt-get update $ sudo apt-get install -y ca-certificates curl ``` -------------------------------- ### Install Angie on openSUSE Source: https://pt.angie.software/angie/docs/installation/oss_packages Commands to configure the repository, install, and manage the Angie service on openSUSE. ```ini [angie] name=Angie repo baseurl=https://download.angie.software/angie/opensuse/$releasever_major/ gpgcheck=1 enabled=1 gpgkey=https://angie.software/keys/angie-signing.gpg.asc ``` ```console $ sudo zypper refresh ``` ```console $ sudo zypper install -y angie ``` ```console $ sudo zypper install -y ``` ```console $ sudo systemctl start angie ``` ```console $ sudo systemctl enable angie ``` -------------------------------- ### Install Angie PRO Package Source: https://pt.angie.software/angie/docs/installation/pro_packages Install the main Angie PRO package. ```console $ sudo apt-get install -y angie-pro ``` -------------------------------- ### Install Angie on FreeBSD Source: https://pt.angie.software/angie/docs/installation/oss_packages Commands to configure the repository, install, and manage the Angie service on FreeBSD. ```console $ sudo mkdir -p /usr/local/etc/pkg/angie/ /usr/local/etc/pkg/repos/ ``` ```console angie: { url: "https://download.angie.software/angie/freebsd/${VERSION_MAJOR}/${ARCH}", signature_type: "pubkey", pubkey: "/usr/local/etc/pkg/angie/angie-signing.rsa", enabled: yes } ``` ```console $ sudo curl -o /usr/local/etc/pkg/angie/angie-signing.rsa \ https://angie.software/keys/angie-signing.rsa ``` ```console $ sudo pkg update ``` ```console $ sudo pkg install -r angie -y angie ``` ```console $ sudo pkg install -r angie -y ``` ```console $ sudo service angie start ``` ```console $ sudo sysrc angie_enable=YES ``` ```console $ sudo pkg upgrade `pkg search -r angie angie-[0-9] | sort -Vr | head -1 | awk {'print $1'}` ``` -------------------------------- ### Demonstrate Echo Functionality Source: https://pt.angie.software/angie/docs/installation/external-modules/echo Command-line examples showing the output of various configured locations. ```console $ curl localhost/echo These lines are inserted by the echo_before_body directive ======== Start backend answer ========= Backend answer body val is set on value ======== End backend answer ========= These lines are added by the echo_after_body directive ``` ```console $ curl localhost/echo_with_sleep hello world ``` ```console $ curl localhost/dup ------ END ------ ``` ```console $ time curl localhost/subr hello world took 3.004 sec for total. real 0m3.027s user 0m0.015s sys 0m0.007s ``` ```console $ time curl localhost/subr_async hello world took 0.000 sec for total. real 0m2.023s user 0m0.001s sys 0m0.020s ``` -------------------------------- ### Manage Angie PRO Service on FreeBSD Source: https://pt.angie.software/angie/docs/installation/pro_packages Commands to start the service and enable it at boot. ```console $ sudo service angie start ``` ```console $ sudo sysrc angie_enable=YES ``` -------------------------------- ### Demonstrate set-misc functionality Source: https://pt.angie.software/angie/docs/installation/external-modules/set-misc Command-line examples showing the output of the configured set-misc directives. ```console $ curl localhost/ifempty/?a=100 arg_a = '100' a = '100' $ curl localhost/ifempty arg_a = '' a = '56' $ curl localhost/unescape/?a=Hello%20world! arg_a = 'Hello%20world!' a = 'Hello world!' b = 'Hello%20world!' $ curl localhost/base32/?a=abcde arg_a = 'abcde' a = 'c5h66p35' b = 'abcde' $ curl localhost/hex/?a=abcde arg_a = 'abcde' a = '6162636465' b = 'abcde' ``` -------------------------------- ### Install Extra Packages on FreeBSD Source: https://pt.angie.software/angie/docs/installation/pro_packages Install optional additional packages as needed. ```console $ sudo pkg install -r angie -y ``` -------------------------------- ### Install and Manage Angie on Alpine Linux Source: https://pt.angie.software/angie/docs/installation/oss_packages Steps to configure the repository, install the package, and manage the service on Alpine Linux. ```console $ sudo apk update $ sudo apk add curl ca-certificates ``` ```console $ sudo curl -o /etc/apk/keys/angie-signing.rsa \ https://angie.software/keys/angie-signing.rsa ``` ```console $ echo "https://download.angie.software/angie/alpine/v$(egrep -o \ '[0-9]+\.[0-9]+' /etc/alpine-release)/main" \ | sudo tee -a /etc/apk/repositories > /dev/null ``` ```console $ sudo apk update ``` ```console $ sudo apk add angie ``` ```console $ sudo apk add ``` ```console $ sudo service angie start ``` ```console $ sudo rc-update add angie ``` -------------------------------- ### Install Extra Packages on Alt Linux Source: https://pt.angie.software/angie/docs/installation/pro_packages Install additional Angie PRO modules as needed. ```console $ sudo apt-get install -y ``` -------------------------------- ### Install Angie on Astra SE Source: https://pt.angie.software/angie/docs/installation/oss_packages Installation steps specific to Astra SE, including optional CSE environment configuration. ```console $ sudo apt-get update $ sudo apt-get install -y ca-certificates curl lsb-release ``` ```console $ sudo curl -o /etc/apt/trusted.gpg.d/angie-signing.gpg \ https://angie.software/keys/angie-signing.gpg ``` ```console $ echo "deb https://download.angie.software/angie/astra-se/$(egrep -o \ '[0-9]+.[0-9]+' /etc/astra_version) unstable main" \ | sudo tee /etc/apt/sources.list.d/angie.list > /dev/null ``` ```console $ sudo apt-get install -y angie-digsig-key ``` ```console $ sudo update-initramfs -uk all ``` ```console $ sudo shutdown -r now ``` -------------------------------- ### Manage Angie PRO Service on Alpine Source: https://pt.angie.software/angie/docs/installation/pro_packages Commands to start the service and enable it at boot. ```console $ sudo service angie start $ sudo rc-update add angie ``` -------------------------------- ### Configure RTMP Streaming Source: https://pt.angie.software/angie/docs/installation/external-modules/rtmp Example configuration for setting up HLS streaming with key management. ```nginx http { server { listen 443 ssl; server_name example.com; ssl_certificate /var/ssl/example.com.pem; ssl_certificate_key /var/ssl/example.com.private; location /keys { root /tmp; } } server { listen 80; server_name example.com; location /hls { root /tmp; } } } rtmp { server { listen 1935; hls on; hls_path /tmp/hls; hls_keys on; hls_key_path /tmp/keys; hls_key_url https://example.com/keys/; hls_fragments_per_key 2; } } ``` -------------------------------- ### PAM Service Configuration Source: https://pt.angie.software/angie/docs/installation/external-modules/auth-pam Example configuration for the PAM service file, such as for LDAP authentication. ```none auth required /lib/security/pam_ldap.so account required /lib/security/pam_ldap.so ``` -------------------------------- ### Requesting a specific start time for MP4 streaming Source: https://pt.angie.software/angie/docs/configuration/modules/http/http_mp4 Example of a URL request to start playback at a specific time in seconds. ```none http://example.com/elephants_dream.mp4?start=238.88 ``` -------------------------------- ### Implement a Basic Angie Module Source: https://pt.angie.software/angie/docs/developer_guide A complete example of a core module implementation, including configuration structure, command definitions, and lifecycle handlers. ```c /* * Copyright (C) Author. */ #include #include typedef struct { ngx_flag_t enable; } ngx_foo_conf_t; static void *ngx_foo_create_conf(ngx_cycle_t *cycle); static char *ngx_foo_init_conf(ngx_cycle_t *cycle, void *conf); static char *ngx_foo_enable(ngx_conf_t *cf, void *post, void *data); static ngx_conf_post_t ngx_foo_enable_post = { ngx_foo_enable }; static ngx_command_t ngx_foo_commands[] = { { ngx_string("foo_enabled"), NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_FLAG, ngx_conf_set_flag_slot, 0, offsetof(ngx_foo_conf_t, enable), &ngx_foo_enable_post }, ngx_null_command }; static ngx_core_module_t ngx_foo_module_ctx = { ngx_string("foo"), ngx_foo_create_conf, ngx_foo_init_conf }; gx_module_t ngx_foo_module = { NGX_MODULE_V1, &ngx_foo_module_ctx, /* module context */ ngx_foo_commands, /* module directives */ NGX_CORE_MODULE, /* module type */ NULL, /* init master */ NULL, /* init module */ NULL, /* init process */ NULL, /* init thread */ NULL, /* exit thread */ NULL, /* exit process */ NULL, /* exit master */ NGX_MODULE_V1_PADDING }; static void * gx_foo_create_conf(ngx_cycle_t *cycle) { ngx_foo_conf_t *fcf; fcf = ngx_pcalloc(cycle->pool, sizeof(ngx_foo_conf_t)); if (fcf == NULL) { return NULL; } fcf->enable = NGX_CONF_UNSET; return fcf; } static char * gx_foo_init_conf(ngx_cycle_t *cycle, void *conf) { ngx_foo_conf_t *fcf = conf; ngx_conf_init_value(fcf->enable, 0); return NGX_CONF_OK; } static char * gx_foo_enable(ngx_conf_t *cf, void *post, void *data) { ngx_flag_t *fp = data; if (*fp == 0) { return NGX_CONF_OK; } ngx_log_error(NGX_LOG_NOTICE, cf->log, 0, "Foo Module is enabled"); return NGX_CONF_OK; } ``` -------------------------------- ### Configure APT for Angie PRO on Alt Linux Source: https://pt.angie.software/angie/docs/installation/pro_packages Set up SSL verification and certificate paths for the repository. ```console $ ( echo 'Acquire::https::Verify-Peer "true";'; echo 'Acquire::https::Verify-Host "true";'; echo 'Acquire::https::SslCert "/etc/ssl/angie/angie-repo.crt";'; echo 'Acquire::https::SslKey "/etc/ssl/angie/angie-repo.key";'; ) | sudo tee -a /etc/apt/apt.conf >/dev/null ``` -------------------------------- ### GET /status/http/upstreams/ Source: https://pt.angie.software/angie/docs/configuration/modules/http/http_api Retrieves the status information for a specific upstream, including downtime duration and the start time of unavailability. ```APIDOC ## GET /status/http/upstreams/ ### Description Retrieves status metrics for a specific upstream peer, including total downtime and the timestamp when the peer became unavailable. ### Method GET ### Endpoint /status/http/upstreams/ ### Parameters #### Path Parameters - **upstream** (string) - Required - The name of the upstream to query. ### Response #### Success Response (200) - **downtime** (number) - Total time in milliseconds the peer was unavailable for selection. - **downstart** (string/number) - The moment the peer became unavailable, formatted as a date. This field is only present while the peer is in the 'unavailable' state. ``` -------------------------------- ### Requesting a specific time range for MP4 streaming Source: https://pt.angie.software/angie/docs/configuration/modules/http/http_mp4 Example of a URL request using both start and end parameters to define a playback range. ```none http://example.com/elephants_dream.mp4?start=238.88&end=555.55 ``` -------------------------------- ### Demonstration File Preparation Source: https://pt.angie.software/angie/docs/installation/external-modules/brotli Commands to list files, create a temporary directory, and generate a compressed version of a file using curl. ```console $ ls -l /usr/share/angie/html/ total 3292 -rw-r--r-- 1 root root 497 Feb 13 07:40 50x.html -rw-r--r-- 1 root root 543 Feb 13 07:40 index.html -rw-r--r-- 1 root root 3359405 Feb 26 12:47 war-and-peace.txt ``` ```console $ mkdir tmp ``` ```console $ curl -s -H 'Accept-encoding: br' -o tmp/war-and-peace.br localhost/war-and-peace.txt ``` ```console $ ls -l tmp/ total 1092 -rw-r--r-- 1 asv asv 1115616 Feb 26 16:52 war-and-peace.br ``` -------------------------------- ### Install Auxiliary Packages Source: https://pt.angie.software/angie/docs/installation/pro_packages Install necessary dependencies for repository management. ```console $ sudo apt-get update $ sudo apt-get install -y apt-transport-https lsb-release \ ca-certificates curl gnupg2 ``` -------------------------------- ### Create FreeBSD Repository Directories Source: https://pt.angie.software/angie/docs/installation/pro_packages Prepare the directory structure for the Angie PRO repository on FreeBSD. ```console $ sudo mkdir -p /usr/local/etc/pkg/angie/ /usr/local/etc/pkg/repos/ ``` -------------------------------- ### Instalar Angie via Homebrew Source: https://pt.angie.software/angie/docs/installation/thirdparty Utilize o Homebrew para adicionar o tap do Angie e realizar a instalação no macOS. ```console $ brew tap stychos/angie $ brew install stychos/angie/angie ``` -------------------------------- ### Compilar e instalar o Angie Source: https://pt.angie.software/angie/docs/installation/sourcebuild Executa o processo de compilação e instalação do binário após a configuração bem-sucedida. ```console $ make $ make install ``` -------------------------------- ### Install Extra Packages on Alpine Source: https://pt.angie.software/angie/docs/installation/pro_packages Install additional Angie PRO modules as needed. ```console $ sudo apk add ``` -------------------------------- ### Hostname Masking Examples Source: https://pt.angie.software/angie/docs/configuration/modules/http/http_map Examples of using hostname masks within a map block. ```nginx *.example.com 1; example.* 1; ``` -------------------------------- ### Configure Alt Linux Repository Source: https://pt.angie.software/angie/docs/installation/oss_packages Steps to prepare the system, import signing keys, and add the specific Angie repository for Alt Linux versions. ```console $ sudo mkdir -p /etc/ssl/angie/ ``` ```console $ sudo apt-get update $ sudo apt-get install -y curl apt-https ``` ```console $ sudo curl -o /etc/ssl/angie/angie-signing.gpg \ https://angie.software/keys/angie-signing.gpg ``` ```console $ sudo gpg --no-default-keyring \ --keyring /usr/lib/alt-gpgkeys/pubring.gpg --import /etc/ssl/angie/angie-signing.gpg ``` ```sh $ echo 'simple-key "angie" { Fingerprint "EB8EAF3D4EF1B1ECF34865A2617AB978CB849A76"; Name "Angie (Signing Key) "; }' | sudo tee /etc/apt/vendors.list.d/angie.list > /dev/null ``` ```console $ echo "rpm [angie] https://download.angie.software/angie/altlinux/11/ $(uname -m) main" \ | sudo tee /etc/apt/sources.list.d/angie.list > /dev/null ``` ```console $ echo "rpm [angie] https://download.angie.software/angie/altlinux/10/ $(uname -m) main" \ | sudo tee /etc/apt/sources.list.d/angie.list > /dev/null ``` ```console $ echo "rpm [angie] https://download.angie.software/angie/altlinux-sp/10/ $(uname -m) main" \ | sudo tee /etc/apt/sources.list.d/angie.list > /dev/null ``` ```console $ echo "rpm [angie] https://download.angie.software/angie/altlinux-sp/8/ $(uname -m) main" \ | sudo tee /etc/apt/sources.list.d/angie.list > /dev/null ``` -------------------------------- ### Update and Install Angie PRO on Alpine Source: https://pt.angie.software/angie/docs/installation/pro_packages Update repository indices and install the main package. ```console $ sudo apk update $ sudo apk add angie-pro ``` -------------------------------- ### Install Auxiliary Packages on Alpine Source: https://pt.angie.software/angie/docs/installation/pro_packages Install necessary tools to manage the Angie PRO repository. ```console $ sudo apk update $ sudo apk add curl ca-certificates ``` -------------------------------- ### Example rewrite configuration Source: https://pt.angie.software/angie/docs/configuration/modules/http/http_rewrite A sample location block demonstrating conditional logic and rewrite rules. ```nginx location /download/ { if ($forbidden) { return 403; } if ($slow) { limit_rate 10k; } rewrite ^/(download/.*)/media/(.*)\..*$ /$1/mp3/$2.mp3 break; } ``` -------------------------------- ### Install Angie on OSNova Source: https://pt.angie.software/angie/docs/installation/oss_packages Commands to configure the repository and install the Angie package on OSNova systems. ```console $ sudo apt-get update $ sudo apt-get install -y ca-certificates curl ``` ```console $ sudo curl -o /etc/apt/trusted.gpg.d/angie-signing.gpg \ https://angie.software/keys/angie-signing.gpg ``` ```console $ echo "deb https://download.angie.software/angie/osnova/$(egrep -o \ '[0-9]*' /etc/osnova_version | head -1) \ $(. /etc/os-release && echo "$VERSION_CODENAME") main" \ | sudo tee /etc/apt/sources.list.d/angie.list > /dev/null ``` ```console $ sudo apt-get update ``` ```console $ sudo apt-get install -y angie ``` ```console $ sudo apt-get install -y ``` -------------------------------- ### Configure GZip Compression Source: https://pt.angie.software/angie/docs/configuration/modules/http/http_gzip Basic configuration example for enabling GZip and setting compression parameters. ```nginx gzip on; gzip_min_length 1000; gzip_proxied expired no-cache no-store private auth; gzip_types text/plain application/xml; ``` -------------------------------- ### Zstandard Header Examples Source: https://pt.angie.software/angie/docs/installation/external-modules/zstd Examples of the Accept-Encoding request header and the resulting Content-Encoding response header. ```none Accept-Encoding: gzip, zstd ``` ```none Content-Encoding: zstd ``` -------------------------------- ### Initialize and Configure Shared Memory Zone Source: https://pt.angie.software/angie/docs/developer_guide Example of adding a shared memory zone and setting up an initialization callback within an Angie module. ```c ngx_str_t name; ngx_foo_ctx_t *ctx; ngx_shm_zone_t *shm_zone; ngx_str_set(&name, "foo"); /* allocate shared zone context */ ctx = ngx_pcalloc(cf->pool, sizeof(ngx_foo_ctx_t)); if (ctx == NULL) { /* error */ } /* add an entry for 64k shared zone */ shm_zone = ngx_shared_memory_add(cf, &name, 65536, &ngx_foo_module); if (shm_zone == NULL) { /* error */ } /* register init callback and context */ shm_zone->init = ngx_foo_init_zone; shm_zone->data = ctx; ``` ```c static ngx_int_t ngx_foo_init_zone(ngx_shm_zone_t *shm_zone, void *data) { ngx_foo_ctx_t *octx = data; size_t len; ngx_foo_ctx_t *ctx; ngx_slab_pool_t *shpool; value = shm_zone->data; if (octx) { /* reusing a shared zone from old cycle */ ctx->value = octx->value; return NGX_OK; } shpool = (ngx_slab_pool_t *) shm_zone->shm.addr; if (shm_zone->shm.exists) { /* initialize shared zone context in Windows Angie worker */ ctx->value = shpool->data; return NGX_OK; } /* initialize shared zone */ ctx->value = ngx_slab_alloc(shpool, sizeof(ngx_uint_t)); if (ctx->value == NULL) { return NGX_ERROR; } shpool->data = ctx->value; return NGX_OK; } ``` -------------------------------- ### Update and Install Angie PRO on FreeBSD Source: https://pt.angie.software/angie/docs/installation/pro_packages Update repository indices and install the Angie PRO package. ```console $ sudo pkg update ``` ```console $ sudo pkg install -r angie -y angie-pro ``` -------------------------------- ### Update and Install Angie PRO on OSNova Source: https://pt.angie.software/angie/docs/installation/pro_packages Update repository indices and install the main Angie package. ```console $ sudo apt-get update ``` ```console $ sudo apt-get install -y angie ``` -------------------------------- ### Exemplo de Configuração com Templates Source: https://pt.angie.software/angie/docs/installation/docker Demonstra como as variáveis de ambiente são aplicadas dentro do arquivo de configuração do Angie usando gomplate. ```none ... {{- if has $modules "zstd"}} # package: angie-module-zstd load_module modules/ngx_http_zstd_filter_module.so; load_module modules/ngx_http_zstd_static_module.so; {{end}} user angie; worker_processes auto; worker_rlimit_nofile {{.Env.ANGIE_WORKER_RLIMIT_NOFILE}}; error_log /var/log/angie/error.log {{.Env.ANGIE_ERROR_LOG_SEVERITY}}; pid {{.Env.ANGIE_PID_FILE}}; events { worker_connections {{.Env.ANGIE_WORKER_CONNECTIONS}}; } http { include /etc/angie/mime.types; default_type application/octet-stream; log_format main ... ``` -------------------------------- ### Stub Status Output Example Source: https://pt.angie.software/angie/docs/configuration/modules/http/http_stub_status Example output format displayed when accessing the configured status page. ```console Active connections: 291 server accepts handled requests 16630948 16630948 31070465 Reading: 6 Writing: 179 Waiting: 106 ``` -------------------------------- ### Install Angie Console Light package Source: https://pt.angie.software/news/articles/multifaceted-monitoring Install the console light package using the system package manager. ```bash sudo apt-get install angie-console-light ``` -------------------------------- ### Update and Install Angie PRO on Alt Linux Source: https://pt.angie.software/angie/docs/installation/pro_packages Update package lists and install the Angie PRO package. ```console $ sudo apt-get update $ sudo apt-get install -y angie-pro ``` -------------------------------- ### Example temporary file path Source: https://pt.angie.software/angie/docs/configuration/modules/http/http_fastcgi Shows the resulting file structure based on the configured fastcgi_temp_path. ```text /spool/angie/fastcgi_temp/7/45/00000123457 ``` -------------------------------- ### Configure OpenTracing Source: https://pt.angie.software/angie/docs/installation/external-modules/opentracing Example configuration for enabling OpenTracing, loading a tracer plugin, and propagating context to backend services. ```nginx http { opentracing on; opentracing_load_tracer /usr/local/lib/libdd_opentracing_plugin.so /etc/datadog-config.json; upstream backend { server app-service:9001; } server { error_log /var/log/angie/debug.log debug; listen 8080; server_name localhost; location = / { opentracing_trace_locations off; proxy_pass http://backend; opentracing_propagate_context; opentracing_tag "resource.name" "/"; } } } ``` -------------------------------- ### Install SPNEGO module packages Source: https://pt.angie.software/angie/docs/installation/external-modules/auth-spnego Use these package names to install the SPNEGO module for Angie or Angie PRO. ```bash angie-module-auth-spnego ``` ```bash angie-pro-module-auth-spnego ``` -------------------------------- ### Image Filter Size Output Example Source: https://pt.angie.software/angie/docs/configuration/modules/http/http_image_filter Example JSON output produced by the size directive for image information. ```json "img" : { "width": 100, "height": 100, "type": "gif" } ``` ```json {} ``` -------------------------------- ### Stream Proxy Configuration Examples Source: https://pt.angie.software/angie/docs/configuration/modules/stream/stream_proxy Demonstrates various server configurations for TCP, UDP, and UNIX domain socket proxying. ```nginx server { listen 127.0.0.1:12345; proxy_pass 127.0.0.1:8080; } server { listen 12345; proxy_connect_timeout 1s; proxy_timeout 1m; proxy_pass example.com:12345; } server { listen 53 udp reuseport; proxy_timeout 20s; proxy_pass dns.example.com:53; } server { listen [::1]:12345; proxy_pass unix:/tmp/stream.socket; } ``` -------------------------------- ### Configure Connection Limits Source: https://pt.angie.software/angie/docs/configuration/modules/http/http_limit_conn Basic configuration example showing how to define a shared memory zone and apply a connection limit to a specific location. ```nginx http { limit_conn_zone $binary_remote_addr zone=addr:10m; ... server { ... location /download/ { limit_conn addr 1; } ``` ```nginx limit_conn_zone $binary_remote_addr zone=addr:10m; server { location /download/ { limit_conn addr 1; } ``` -------------------------------- ### Configure Zstandard Compression Source: https://pt.angie.software/angie/docs/installation/external-modules/zstd Example configuration demonstrating dynamic compression for files and backends, as well as serving pre-compressed .zst files. ```nginx server { listen 80 default_server; zstd_types text/plain text/css; zstd_min_length 256; # Comprimento mínimo da resposta para compressão zstd_comp_level 3; # Nível de compressão (1 a 22) # Compressão dinâmica de arquivos location / { zstd on; root /usr/share/angie/html; } # Compressão dinâmica de respostas de backend location /bk/ { zstd on; proxy_pass http://127.0.0.1:8081/; } # Usando arquivos pré-comprimidos .zst location /static/ { zstd_static on; root /usr/share/angie; } } server { listen 8081; location / { root /usr/share/angie/html; index index.html; } } ``` -------------------------------- ### Install and Manage Angie on RPM-based Systems Source: https://pt.angie.software/angie/docs/installation/oss_packages Commands to install the Angie package, optional extras, and manage the systemd service. ```console $ sudo yum install -y angie $ # -- OU -- $ sudo dnf install -y angie ``` ```console $ sudo yum install -y $ # -- OU -- $ sudo dnf install -y ``` ```console $ sudo systemctl start angie ``` ```console $ sudo systemctl enable angie ``` -------------------------------- ### Configure Echo Directives Source: https://pt.angie.software/angie/docs/installation/external-modules/echo Example demonstrating body manipulation, sleep, duplication, and subrequest handling. ```nginx server { listen 80; server_name localhost; location /echo { echo_before_body 'These lines are inserted'; echo_before_body 'by the echo_before_body directive'; echo_after_body 'These lines are added'; echo_after_body 'by the echo_after_body directive'; proxy_pass $scheme://127.0.0.1:$server_port$request_uri/more; } location /echo/more { set $val 'value'; echo '======== Start backend answer ========='; echo 'Backend answer body'; echo "val is set on $val"; echo '======== End backend answer ==========='; } location /echo_with_sleep { echo hello; echo_flush; echo_sleep 2.5; echo world; } location /dup { echo_duplicate 3 "--"; echo_duplicate 1 " END "; echo_duplicate 3 "--"; echo; } location /subr { echo_reset_timer; echo_location /sub1; echo_location /sub2; echo "took $echo_timer_elapsed sec for total."; } location /subr_async { echo_reset_timer; echo_location_async /sub1; echo_location_async /sub2; echo "took $echo_timer_elapsed sec for total."; } location /sub1 { echo_sleep 2; echo hello; } location /sub2 { echo_sleep 1; echo world; } } ``` -------------------------------- ### Install Angie PRO on Astra SE (CSE Mode) Source: https://pt.angie.software/angie/docs/installation/pro_packages Optional steps for installing the digital signature key and updating the system in CSE mode. ```console $ sudo apt-get install -y angie-digsig-key ``` ```console $ sudo update-initramfs -uk all ``` ```console $ sudo shutdown -r now ``` -------------------------------- ### Configure Angie for Certificate API Source: https://pt.angie.software/angie/docs/configuration/modules/http/http_api Example configuration showing how to set up a resolver, an ACME client, and the /certificates/ API endpoint within an http block. ```nginx http { resolver 127.0.0.53; acme_client example https://acme.example.com/directory; server { listen 443 ssl; server_name www.example.com; ssl_certificate example.com.crt; ssl_certificate_key example.com.key; location /certificates/ { api /certificates/; } } server { listen 443 ssl; server_name acme.example.com; acme example; ssl_certificate $acme_cert_example; ssl_certificate_key $acme_cert_key_example; } } ``` -------------------------------- ### Proxying to Mongrel Source: https://pt.angie.software/angie/docs/configuration/modules/http Example configuration for proxying requests to a Mongrel backend. ```nginx location / { try_files /system/maintenance.html $uri $uri/index.html $uri.html @mongrel; } location @mongrel { proxy_pass http://mongrel; } ``` -------------------------------- ### Configurar a compilação Source: https://pt.angie.software/angie/docs/installation/sourcebuild Prepara o ambiente de compilação. Pode ser executado sem opções para uma instalação mínima ou com opções específicas para módulos e bibliotecas. ```console $ ./configure ``` ```console $ ./configure ``` -------------------------------- ### GET /status/http/upstreams/ Source: https://pt.angie.software/angie/docs/configuration/modules/http/http_api Retrieves statistical data for a specified upstream. ```APIDOC ## GET /status/http/upstreams/ ### Description Retrieves statistics for the specified upstream peer. ### Method GET ### Endpoint /status/http/upstreams/ ### Parameters #### Path Parameters - **upstream** (string) - Required - The name of the upstream to query. ### Response #### Success Response (200) - **data** (object) - Statistics data object. - **received** (number) - The total number of bytes received from the peer. ``` -------------------------------- ### Verify MD5 hash mechanism Source: https://pt.angie.software/angie/docs/configuration/modules/http/http_upstream Command line example to verify the hash mechanism by echoing the value and salt. ```console $ echo -n "" | md5sum ``` -------------------------------- ### Add Angie PRO Repository on OSNova Source: https://pt.angie.software/angie/docs/installation/pro_packages Configure the APT source list for the Angie PRO repository. ```console $ echo "deb https://download.angie.software/angie-pro/osnova/$(egrep -o \ '[0-9]*' /etc/osnova_version | head -1) \ $(. /etc/os-release && echo "$VERSION_CODENAME") main" \ | sudo tee /etc/apt/sources.list.d/angie.list > /dev/null ``` -------------------------------- ### GET /status/http/ Source: https://pt.angie.software/angie/docs/configuration/modules/http/http_api Retrieves HTTP-related status metrics from the Angie server. ```APIDOC ## GET /status/http/ ### Description Retrieves the HTTP status metrics tree, providing insights into cache, connection limits, request limits, and upstream server performance. ### Method GET ### Endpoint /status/http/ ``` -------------------------------- ### Basic Angie Server Configuration Source: https://pt.angie.software/angie/docs/configuration/modules/core Example of a standard configuration block defining user, worker processes, error logging, and event handling. ```nginx user www www; worker_processes 2; error_log /var/log/error.log info; events { use kqueue; worker_connections 2048; } ``` -------------------------------- ### GET / Source: https://pt.angie.software/angie/docs/configuration/modules/http/http_api Retrieves basic server information and statistics in JSON format. ```APIDOC ## GET / ### Description Retrieves basic information about the web server and statistics regarding client connections, shared memory zones, DNS queries, HTTP requests, cache, and module-specific limits. ### Method GET ### Endpoint / ### Response #### Success Response (200) - **JSON** (object) - Server status and metrics data. #### Error Response (405) - **error** (string) - "MethodNotAllowed" - **description** (string) - Error message indicating the method is not allowed. ``` -------------------------------- ### $r->variable(name [, value ]) Source: https://pt.angie.software/angie/docs/configuration/modules/http/http_perl Gets or sets a request-specific variable. ```APIDOC ## $r->variable(name [, value ]) ### Description Returns or sets the value of the specified variable. Variables are local to each request. ### Parameters - **name** (string) - Required - The name of the variable. - **value** (string) - Optional - The value to assign to the variable. ``` -------------------------------- ### Configure Repository SSL Source: https://pt.angie.software/angie/docs/installation/pro_packages Create the apt configuration file to use SSL certificates for the repository. ```console Acquire::https::download.angie.software::Verify-Peer "true"; Acquire::https::download.angie.software::Verify-Host "true"; Acquire::https::download.angie.software::SslCert "/etc/ssl/angie/angie-repo.crt"; Acquire::https::download.angie.software::SslKey "/etc/ssl/angie/angie-repo.key"; ``` -------------------------------- ### Retrieve upstream status Source: https://pt.angie.software/angie/docs/configuration/modules/http/http_api Example JSON response for the /status/http/upstreams/ endpoint. ```json { "peers": { "192.168.16.4:80": { "server": "backend.example.com", "service": "_example._tcp", "backup": false, "weight": 5, "state": "up", "selected": { "current": 2, "total": 232 }, "max_conns": 5, "responses": { "200": 222, "302": 12 }, "data": { "sent": 543866, "received": 27349934 }, "health": { "fails": 0, "unavailable": 0, "downtime": 0 }, "sid": "" } }, "keepalive": 2 } ```