### Check Configuration and Start Angie Source: https://en.angie.software/angie/docs/configuration/runtime Before starting, it's recommended to check the configuration syntax. This command checks the syntax and then starts Angie if the syntax is valid. ```bash $ sudo angie -t && sudo service angie start ``` -------------------------------- ### Start Angie Service Source: https://en.angie.software/angie/docs/installation/oss_packages Start the Angie service using systemctl. This command is used after installation to get Angie running. ```console $ sudo systemctl start angie ``` -------------------------------- ### Start Angie Service Source: https://en.angie.software/angie/docs/installation/pro_packages Starts the Angie service. This command is used to run the Angie server after installation. ```bash sudo systemctl start angie ``` -------------------------------- ### Start Angie and Synchronization Source: https://en.angie.software/angie/docs/configuration/cluster After configuring health checks, start the Angie service by testing the configuration and then starting the service. Subsequently, initiate the configuration synchronization process using the `angiehasync -Sd` command. ```bash $ sudo angie -t && sudo service angie start ``` ```bash $ sudo angiehasync -Sd ``` -------------------------------- ### Install Angie PRO Package on openSUSE Source: https://en.angie.software/angie/docs/installation/pro_packages Installs the Angie PRO package on openSUSE using Zypper. ```console $ sudo zypper install -y angie-pro ``` -------------------------------- ### Example: ngx_foo_module Implementation Source: https://en.angie.software/angie/docs/developer_guide A complete C example of a custom Angie module, demonstrating module context, commands, and configuration handlers. Includes creation and initialization of module-specific configuration. ```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 }; ngx_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 * g_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 * g_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 * g_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; } ``` -------------------------------- ### Install Angie Package on openSUSE Source: https://en.angie.software/angie/docs/installation/oss_packages Installs the Angie package on an openSUSE system using zypper. ```console $ sudo zypper install -y angie ``` -------------------------------- ### RTMP Module Configuration Example Source: https://en.angie.software/angie/docs/installation/external-modules/rtmp Example configuration for the RTMP module, including HTTP servers for HLS and MPEG-DASH streams, and the RTMP server setup. ```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; } } ``` -------------------------------- ### MP4 Pseudo-Streaming Request Example Source: https://en.angie.software/angie/docs/configuration/modules/http/http_mp4 Demonstrates a typical HTTP request to an MP4 file with a specified start time for pseudo-streaming. ```none http://example.com/elephants_dream.mp4?start=238.88 ``` -------------------------------- ### Install Angie PRO Package on FreeBSD Source: https://en.angie.software/angie/docs/installation/pro_packages Installs the Angie PRO package on FreeBSD. ```console $ sudo pkg install -r angie -y angie-pro ``` -------------------------------- ### Example Angie HTTP Configuration Source: https://en.angie.software/angie/docs/configuration/modules/http/http_api A comprehensive example configuration demonstrating various directives including resolver, upstream, server, location, cache, and limit zones, with specific status_zone configurations. ```nginx http { resolver 127.0.0.53 status_zone=resolver_zone; proxy_cache_path /var/cache/angie/cache keys_zone=cache_zone:2m; limit_conn_zone $binary_remote_addr zone=limit_conn_zone:10m; limit_req_zone $binary_remote_addr zone=limit_req_zone:10m rate=1r/s; upstream upstream { zone upstream 256k; server backend.example.com service=_example._tcp resolve max_conns=5; keepalive 4; } server { server_name www.example.com; listen 443 ssl; status_zone http_server_zone; proxy_cache cache_zone; proxy_cache_valid 200 10m; access_log /var/log/access.log main; location / { root /usr/share/angie/html; status_zone location_zone; limit_conn limit_conn_zone 1; limit_req zone=limit_req_zone burst=5; } location /status/ { api /status/; allow 127.0.0.1; deny all; } } } ``` -------------------------------- ### Zstandard Module Configuration Example Source: https://en.angie.software/angie/docs/installation/external-modules/zstd Example Nginx configuration demonstrating how to enable Zstandard compression for different locations, including dynamic compression of responses and serving precompressed .zst files. ```nginx server { listen 80 default_server; zstd_types text/plain text/css; zstd_min_length 256; # Minimum response length for compression zstd_comp_level 3; # Compression level (1 to 22) # Dynamic file compression location / { zstd on; root /usr/share/angie/html; } # Dynamic compression of backend responses location /bk/ { zstd on; proxy_pass http://127.0.0.1:8081/; } # Using precompressed .zst files location /static/ { zstd_static on; root /usr/share/angie; } } server { listen 8081; location / { root /usr/share/angie/html; index index.html; } } ``` -------------------------------- ### Build and Install Angie Source: https://en.angie.software/angie/docs/installation/sourcebuild Compiles the Angie source code and installs the built binaries and configuration files to the system. ```console $ make $ make install ``` -------------------------------- ### Wasmtime Configuration Example Source: https://en.angie.software/angie/docs/configuration/modules/wasm/wasm_wasmtime Example configuration block for the Wasmtime module, demonstrating how to set stack size, enable WASI, and load a WASM module. ```nginx wasm_modules { wasmtime_stack_size 8k; wasmtime_enable_wasi on; load fft_transform.wasm id=fft; } ``` -------------------------------- ### Install Angie Package on FreeBSD Source: https://en.angie.software/angie/docs/installation/oss_packages Installs the Angie package on a FreeBSD system using the configured repository. ```console $ sudo pkg install -r angie -y angie ``` -------------------------------- ### Copy ModSecurity Configuration Examples Source: https://en.angie.software/angie/docs/installation/external-modules/modsecurity Copy the necessary example ModSecurity configuration files from the cloned rule set. ```bash $ 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 ``` -------------------------------- ### Install Prerequisites for Angie Repo Source: https://en.angie.software/angie/docs/installation/oss_packages Installs essential packages like curl and apt-https required for adding the Angie repository. ```bash $ sudo apt-get update $ sudo apt-get install -y curl apt-https ``` -------------------------------- ### Start Docker Services Source: https://en.angie.software/angie/docs/configuration/oidc Use this command to start the necessary Docker services for the OIDC deployment. ```console $ docker-compose up -d ``` -------------------------------- ### Retrieve HTTP Configuration Example Response Source: https://en.angie.software/angie/docs/configuration/modules/http/http_api Example JSON response when retrieving configuration for a server. ```json { "backend.example.com": { "weight": 1, "max_conns": 5, "max_fails": 1, "fail_timeout": 10, "slow_start": 0, "backup": false, "down": false, "sid": "" } } ``` -------------------------------- ### Install Prerequisites for Debian/Ubuntu Source: https://en.angie.software/angie/docs/installation/oss_packages Installs prerequisites for adding the Angie repository on Debian and Ubuntu systems, including ca-certificates and curl. ```bash $ sudo apt-get update $ sudo apt-get install -y ca-certificates curl ``` -------------------------------- ### Install Angie Package Source: https://en.angie.software/angie/docs/installation/oss_packages Installs the Angie web server package using the system's package manager. ```bash $ sudo apt-get install -y angie ``` -------------------------------- ### Install Optional Extra Packages on openSUSE Source: https://en.angie.software/angie/docs/installation/oss_packages Installs additional optional packages for Angie on openSUSE. Replace with the desired package. ```console $ sudo zypper install -y ``` -------------------------------- ### Install Build Prerequisites on RHEL/Fedora Source: https://en.angie.software/angie/docs/installation/sourcebuild Installs essential build tools and development libraries for PCRE2, zlib, and OpenSSL on RHEL-based systems. ```console $ sudo dnf install gcc make pcre2-devel zlib-devel openssl-devel ``` -------------------------------- ### Example of Loaded Configuration File Content Source: https://en.angie.software/angie/docs/configuration/modules/http/http_api This JSON snippet illustrates the format for the `config_files` object within the /status/angie endpoint. It shows an example of how a configuration file's absolute path is mapped to its string representation. ```json { "/etc/angie/angie.conf": "server {\n listen 80;\n # ...\n\n}\n" } ``` -------------------------------- ### Install Build Prerequisites on Debian/Ubuntu Source: https://en.angie.software/angie/docs/installation/sourcebuild Installs essential build tools and development libraries for PCRE2, zlib, and OpenSSL on Debian-based systems. ```console $ sudo apt install build-essential libpcre2-dev zlib1g-dev libssl-dev ``` -------------------------------- ### Install Prerequisites for Angie PRO Repository (Astra SE) Source: https://en.angie.software/angie/docs/installation/pro_packages Installs essential packages required for adding the Angie PRO repository on Astra SE. ```bash $ sudo apt-get update $ sudo apt-get install -y apt-transport-https lsb-release \ ca-certificates curl gnupg2 ``` -------------------------------- ### Install Optional Extra Packages on FreeBSD Source: https://en.angie.software/angie/docs/installation/oss_packages Installs additional optional packages for Angie on FreeBSD. Replace with the desired package. ```console $ sudo pkg install -r angie -y ``` -------------------------------- ### Testcookie Module Configuration Example Source: https://en.angie.software/angie/docs/installation/external-modules/testcookie A complete configuration example for the testcookie module, demonstrating various directives for bot protection, whitelisting, and custom templates. ```nginx http { testcookie off; testcookie_name BPC; testcookie_secret keepmesecret; testcookie_session $remote_addr; testcookie_arg ckattempt; testcookie_max_attempts 3; testcookie_p3p 'CP="CUR ADM OUR NOR STA NID", policyref="/w3c/p3p.xml"'; testcookie_fallback http://google.com/cookies.html?backurl=http://$host$request_uri; testcookie_whitelist { 8.8.8.8/32; } testcookie_redirect_via_refresh on; testcookie_refresh_encrypt_cookie on; testcookie_refresh_encrypt_cookie_key deadbeefdeadbeefdeadbeefdeadbeef; testcookie_refresh_encrypt_cookie_iv deadbeefdeadbeefdeadbeefdeadbeef; testcookie_refresh_template 'setting cookie...'; server { listen 80; server_name test.com; location = /aes.min.js { gzip on; gzip_min_length 1000; gzip_types text/plain; root /var/www/public_html; } location = /w3c/p3p.xml { root /var/www/public_html; } location = /.well-known/acme-challenge/ { root /var/www/public_html; } location / { testcookie on; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:80; } } } ``` -------------------------------- ### Example: Creating and Populating a Buffer Chain Source: https://en.angie.software/angie/docs/developer_guide Demonstrates how to allocate chain links and buffers, populate them with data, and link them together for output operations. Ensure proper error handling for memory allocation. ```c ngx_chain_t * ngx_get_my_chain(ngx_pool_t *pool) { ngx_buf_t *b; ngx_chain_t *out, *cl, **ll; /* first buf */ cl = ngx_alloc_chain_link(pool); if (cl == NULL) { /* error */ } b = ngx_calloc_buf(pool); if (b == NULL) { /* error */ } b->start = (u_char *) "foo"; b->pos = b->start; b->end = b->start + 3; b->last = b->end; b->memory = 1; /* read-only memory */ cl->buf = b; out = cl; ll = &cl->next; /* second buf */ cl = ngx_alloc_chain_link(pool); if (cl == NULL) { /* error */ } b = ngx_create_temp_buf(pool, 3); if (b == NULL) { /* error */ } b->last = ngx_cpymem(b->last, "foo", 3); cl->buf = b; cl->next = NULL; *ll = cl; return out; } ``` -------------------------------- ### Queue Example Usage Source: https://en.angie.software/angie/docs/developer_guide Demonstrates initializing a queue, inserting a node, and iterating through the queue. ```c typedef struct { ngx_str_t value; ngx_queue_t queue; } ngx_foo_t; ngx_foo_t *f; ngx_queue_t values, *q; ngx_queue_init(&values); f = ngx_palloc(pool, sizeof(ngx_foo_t)); if (f == NULL) { /* error */ } ngx_str_set(&f->value, "foo"); ngx_queue_insert_tail(&values, &f->queue); /* insert more nodes here */ for (q = ngx_queue_head(&values); q != ngx_queue_sentinel(&values); q = ngx_queue_next(q)) { f = ngx_queue_data(q, ngx_foo_t, queue); ngx_do_smth(&f->value); } ``` -------------------------------- ### Stream Context Docker Configuration Source: https://en.angie.software/angie/docs/configuration/modules/http/http_docker Example demonstrating Docker endpoint configuration within both http and stream contexts. This setup enables dynamic upstream management for both HTTP and TCP/UDP traffic. ```nginx http { # Examples of connection options: # docker_endpoint http://127.0.0.1:2375; # docker_endpoint https://127.0.0.1:2376; docker_endpoint unix:/var/run/docker.sock; # maximum Docker response buffer size (optional) # docker_max_object_size 128k; } stream { upstream u { zone z 1m; } server { listen 12345; proxy_pass u; } } ``` -------------------------------- ### WASM Module Configuration Example Source: https://en.angie.software/angie/docs/configuration/modules/wasm This example demonstrates how to load WASM modules and configure their behavior within Angie. It includes loading core WASM functionality, specific runtimes like Wasmtime, and HTTP handler modules. It also shows how to define WASM variables and set up locations for WASM handlers. ```none # These directives load the core functionality load_module modules/ngx_wasm_module.so; load_module modules/ngx_wasm_core_module.so; load_module modules/ngx_wasmtime_module.so; # Available here: https://git.angie.software/web-server/angie-wasm load_module modules/ngx_http_wasm_host_module.so; events { } wasm_modules { #use wasmtime; load ngx_http_handler.wasm id=handler; load ngx_http_vars.wasm id=vars type=reactor; } http { wasm_var vars "ngx:wasi/var-utils#sum-entry" $rvar $arg_a $arg_b $arg_c $arg_d; server { listen *:8080; location / { return 200 "sum('$arg_a','$arg_b','$arg_c','$arg_d')=$rvar\n"; } location /wasm { client_max_body_size 20M; wasm_content handler "ngx:wasi/http-handler-entry#handle-request"; } } } ``` -------------------------------- ### try_files for Drupal/FastCGI integration Source: https://en.angie.software/angie/docs/configuration/modules/http Configures Angie to handle 404 errors by redirecting to a named location '@drupal' and uses try_files to check for PHP files before passing to FastCGI. This setup is typical for Drupal installations. ```nginx location / { error_page 404 = @drupal; } location ~ \.php$ { try_files $uri @drupal; fastcgi_pass ...; fastcgi_param SCRIPT_FILENAME /path/to/index.php; fastcgi_param SCRIPT_NAME /index.php; fastcgi_param QUERY_STRING q=$uri&$args; # ... other 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; # ... other fastcgi_param } ``` -------------------------------- ### Install Keepalived Package Source: https://en.angie.software/angie/docs/configuration/cluster Install the Keepalived package using your system's package manager if it's not already installed. ```bash $ sudo {apk|apt|pkg|yum|zypper} {add|install} keepalived ``` -------------------------------- ### Start Keepalived Service Source: https://en.angie.software/angie/docs/configuration/cluster Start the Keepalived service after configuring it. It's recommended to test the configuration with `-t` before starting the service. ```bash $ sudo keepalived -t && sudo service keepalived start ``` -------------------------------- ### Configure Minimal Angie Build Source: https://en.angie.software/angie/docs/installation/sourcebuild Prepares the build environment by running the configure script with default settings, assuming prerequisites are installed. ```console $ ./configure ``` -------------------------------- ### Install Angie Web Server on Debian Source: https://en.angie.software/news/articles/multifaceted-monitoring Installs Angie web server on Debian-based systems by adding the GPG key and repository, then installing the package. Ensure you have necessary tools like curl and lsb-release installed. ```bash sudo apt-get update && \ sudo apt-get install --no-install-recommends --no-install-suggests --yes \ ca-certificates curl lsb-release && \ sudo curl -o /etc/apt/trusted.gpg.d/angie-signing.gpg \ https://angie.software/keys/angie-signing.gpg && \ echo "deb https://download.angie.software/angie/debian/ `lsb_release -cs` main" \ | sudo tee /etc/apt/sources.list.d/angie.list >/dev/null ``` ```bash sudo apt-get update && \ sudo apt-get install --no-install-recommends --no-install-suggests --yes \ angie ``` -------------------------------- ### Example Listen Directive with Socket Options Source: https://en.angie.software/angie/docs/configuration/modules/http Demonstrates a listen directive with accept_filter and backlog parameters. ```nginx listen 127.0.0.1 default_server accept_filter=dataready backlog=1024; ``` -------------------------------- ### Basic Angie Server Configuration Source: https://en.angie.software/angie/docs/configuration/modules/core A foundational configuration example for the Angie server, setting up 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; } ``` -------------------------------- ### Install Optional Extra Packages Source: https://en.angie.software/angie/docs/installation/oss_packages Install additional Angie packages not included in the base installation. Replace '' with the desired package. ```console $ sudo yum install -y $ # -- OR -- $ sudo dnf install -y ``` -------------------------------- ### Demonstrate Basic SET/GET Commands Source: https://en.angie.software/angie/docs/installation/external-modules/redis2 Demonstrates the output of basic SET and GET commands executed via curl. Shows successful responses and handling of non-existent keys. ```console $ curl localhost/foo +OK $ curl localhost/bar $5 first ``` ```console $ curl 'localhost/set/?key=two&val=second%20value' +OK $ curl 'localhost/get/?key=two' $12 second value $ curl 'localhost/get/?key=three' $-1 ``` -------------------------------- ### Install Angie Package using yum or dnf Source: https://en.angie.software/angie/docs/installation/oss_packages Install the Angie package using either the yum or dnf package manager. Use the '-y' flag to automatically confirm the installation. ```console $ sudo yum install -y angie $ # -- OR -- $ sudo dnf install -y angie ``` -------------------------------- ### Prepare Test File Source: https://en.angie.software/angie/docs/installation/external-modules/brotli Create a directory and download a compressed file using curl with Accept-encoding header. ```bash $ 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 ``` ```bash $ mkdir tmp ``` ```bash $ curl -s -H 'Accept-encoding: br' -o tmp/war-and-peace.br localhost/war-and-peace.txt ``` ```bash $ ls -l tmp/ total 1092 -rw-r--r-- 1 asv asv 1115616 Feb 26 16:52 war-and-peace.br ``` -------------------------------- ### Install angie-ha-sync Package Source: https://en.angie.software/angie/docs/configuration/cluster Install the high-availability synchronization module on all cluster nodes using your OS package manager. This command also installs the corresponding Angie package as a dependency if it's not already present. ```bash $ sudo {apk|apt|pkg|yum|zypper} {add|install} angie-pro-ha-sync ``` -------------------------------- ### Demonstration: Client Supports Brotli Source: https://en.angie.software/angie/docs/installation/external-modules/unbrotli Example showing how a client supporting Brotli receives the compressed file directly without server-side decompression. ```console $ curl -s -H 'Accept-Encoding: br' -o tmp/war-and-peace.txt localhost/storage/war-and-peace.txt $ ls -l tmp/ total 1092 -rw-r--r-- 1 asv asv 1115616 Feb 27 16:36 war-and-peace.txt ``` -------------------------------- ### Configure Angie Build with Options Source: https://en.angie.software/angie/docs/installation/sourcebuild Prepares the build environment by running the configure script with custom options to include specific modules and libraries. ```console $ ./configure ``` -------------------------------- ### Install Angie with MacPorts on macOS Source: https://en.angie.software/angie/docs/installation/thirdparty Use this command to install Angie via MacPorts on macOS. ```bash $ sudo port install angie ``` -------------------------------- ### Multiple Client Blocks with Inheritance Source: https://en.angie.software/angie/docs/configuration/modules/http Demonstrates how to use multiple client blocks to group common settings for different internal locations, showcasing inheritance of directives. ```nginx client { proxy_set_header Host docker.example.com; proxy_set_header Authorization "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="; location @docker_events { } location @docker_containers { } } client { proxy_method GET; proxy_set_header Host backend.example.com; proxy_set_header X-Real-IP $remote_addr; location @health_check { proxy_pass http://upstream-server/health; } } ``` -------------------------------- ### Listen Directive Examples Source: https://en.angie.software/angie/docs/configuration/modules/http Demonstrates various ways to specify listen addresses and ports for the HTTP module. ```nginx listen 127.0.0.1:8000; listen 127.0.0.1; listen 8000; listen *:8000; listen localhost:8000; ``` ```nginx listen [::]:8000; listen [::1]; ``` ```nginx listen unix:/var/run/angie.sock; ``` -------------------------------- ### Location Matching Examples Source: https://en.angie.software/angie/docs/configuration/modules/http Demonstrates various ways to define location blocks using prefix strings, regular expressions, exact matches, and prefix modifiers. ```nginx location =/ { #configuration A } location / { #configuration B } location /documents/ { #configuration C } location ^~/images/ { #configuration D } location ~*\.(gif|jpg|jpeg)$ { #configuration E } ``` -------------------------------- ### Basic Stream Return Configuration Source: https://en.angie.software/angie/docs/configuration/modules/stream/stream_return This example demonstrates a basic server configuration that listens on a specific port and returns the current ISO 8601 formatted time to the client. ```nginx server { listen 12345; return $time_iso8601; } ``` -------------------------------- ### Install Angie with Homebrew on macOS Source: https://en.angie.software/angie/docs/installation/thirdparty Use these commands to tap the Angie Homebrew repository and install Angie. ```bash $ brew tap stychos/angie $ brew install stychos/angie/angie ``` -------------------------------- ### Configure openSUSE Angie PRO Repository Source: https://en.angie.software/angie/docs/installation/pro_packages Creates the angie.repo file to configure the Angie PRO repository on openSUSE. ```ini [angie-pro] enabled=1 autorefresh=1 baseurl=https://download.angie.software/angie-pro/opensuse/$releasever_major?ssl_clientcert=/etc/ssl/angie/angie-repo-bundle.crt&ssl_verify=peer gpgcheck=1 gpgkey=https://angie.software/keys/angie-signing.gpg.asc ``` -------------------------------- ### Enable GZip Static Module Source: https://en.angie.software/angie/docs/configuration/modules/http/http_gzip_static Enables the gzip_static module and configures proxy settings for compressed content. Use this to allow Angie to serve precompressed files. ```nginx gzip_static on; gzip_proxied expired no-cache no-store private auth; ``` -------------------------------- ### Create FreeBSD Package Directories Source: https://en.angie.software/angie/docs/installation/oss_packages Creates the necessary directories for configuring the Angie package repository on FreeBSD. ```console $ sudo mkdir -p /usr/local/etc/pkg/angie/ /usr/local/etc/pkg/repos/ ``` -------------------------------- ### Install Angie Package on Alpine Source: https://en.angie.software/angie/docs/installation/oss_packages Install the Angie package on Alpine Linux using the apk package manager. ```console $ sudo apk add angie ``` -------------------------------- ### Example Accept-Encoding Header Source: https://en.angie.software/angie/docs/installation/external-modules/zstd Illustrates the Accept-Encoding header that indicates client support for Zstandard compression. ```none Accept-Encoding: gzip, zstd ``` -------------------------------- ### Single-line Comment Example Source: https://en.angie.software/angie/docs/developer_guide Example of a single-line comment used for brief explanations, such as clarifying the purpose of a code block. ```c /* find the server configuration for the address:port */ ``` -------------------------------- ### Install Angie PRO Package on Alpine Source: https://en.angie.software/angie/docs/installation/pro_packages Installs the main Angie PRO package using the Alpine package manager. ```console $ sudo apk add angie-pro ``` -------------------------------- ### Install Extra Packages Source: https://en.angie.software/angie/docs/installation/pro_packages Installs additional Angie PRO packages if needed. Replace with the desired package. ```bash sudo yum install -y $ # -- OR -- $ sudo dnf install -y ``` -------------------------------- ### Install Optional Angie Packages Source: https://en.angie.software/angie/docs/installation/oss_packages Installs additional optional packages for Angie. Replace with the desired package. ```bash $ sudo apt-get install -y ``` -------------------------------- ### Enable Angie Autostart on FreeBSD Source: https://en.angie.software/angie/docs/installation/oss_packages Configures Angie to start automatically after a server reboot on FreeBSD. ```console $ sudo sysrc angie_enable=YES ``` -------------------------------- ### Stream Session: Get Client Address Source: https://en.angie.software/angie/docs/configuration/njs-reference Access s.remoteAddress to get the client's IP address. This property is read-only. ```javascript s.remoteAddress ``` -------------------------------- ### Creating and Iterating Over an Angie List Source: https://en.angie.software/angie/docs/developer_guide Demonstrates the creation of an Angie list using `ngx_list_create` and adding items with `ngx_list_push`. It also shows how to iterate over the list elements by traversing its parts. ```c ngx_str_t *v; ngx_uint_t i; ngx_list_t *list; ngx_list_part_t *part; list = ngx_list_create(pool, 100, sizeof(ngx_str_t)); if (list == NULL) { /* error */ } /* add items to the list */ v = ngx_list_push(list); if (v == NULL) { /* error */ } ngx_str_set(v, "foo"); v = ngx_list_push(list); if (v == NULL) { /* error */ } ngx_str_set(v, "bar"); /* iterate over the list */ part = &list->part; v = part->elts; for (i = 0; /* void */; i++) { if (i >= part->nelts) { if (part->next == NULL) { break; } part = part->next; v = part->elts; i = 0; } ngx_do_smth(&v[i]); } ``` -------------------------------- ### Install Prerequisites for Astra SE Source: https://en.angie.software/angie/docs/installation/oss_packages Installs prerequisites for adding the Angie repository on Astra SE, including ca-certificates, curl, and lsb-release. ```bash $ sudo apt-get update $ sudo apt-get install -y ca-certificates curl lsb-release ``` -------------------------------- ### Configure FreeBSD Angie PRO Repository Source: https://en.angie.software/angie/docs/installation/pro_packages Creates the angie.conf file to configure the Angie PRO repository on FreeBSD. ```pkgconfig angie: { url: "https://download.angie.software/angie-pro/freebsd/${VERSION_MAJOR}/${ARCH}", signature_type: "pubkey", pubkey: "/usr/local/etc/pkg/angie/angie-signing.rsa", enabled: yes } ``` -------------------------------- ### Angie Configuration File Structure Source: https://en.angie.software/angie/docs/configuration/configfile This example demonstrates the hierarchical structure of an Angie configuration file, including main, events, http (with server and location blocks), and stream contexts. ```nginx user angie; # a directive in the 'main' context events { # configuration of connection processing } http { # Configuration specific to HTTP and affecting all virtual servers server { # configuration of HTTP virtual server 1 location /one { # configuration for processing URIs starting with '/one' } location /two { # configuration for processing URIs starting with '/two' } } server { # configuration of HTTP virtual server 2 } } stream { # Configuration specific to TCP/UDP and affecting all virtual servers server { # configuration of TCP virtual server 1 } } ``` -------------------------------- ### Install Alpine Prerequisites Source: https://en.angie.software/angie/docs/installation/oss_packages Update package lists and install curl and ca-certificates, which are prerequisites for adding the Angie repository on Alpine Linux. ```console $ sudo apk update $ sudo apk add curl ca-certificates ``` -------------------------------- ### Verify Angie Installation Source: https://en.angie.software/angie/docs/configuration/migration Check the installed Angie version and its nginx compatibility. This command also reveals the default configuration path. ```console $ sudo angie -V Angie version: Angie/|version| nginx version: nginx/|nginxversion| built by gcc 11.4.0 configure arguments: --prefix=/etc/angie --conf-path=/etc/angie/angie.conf ... ``` -------------------------------- ### Example: Rewriting Location Header Source: https://en.angie.software/angie/docs/configuration/modules/http/http_proxy Demonstrates how to rewrite the 'Location' header from a proxied server. This example changes the base URL in the header. ```nginx proxy_redirect http://localhost:8000/two/ http://frontend/one/; ``` -------------------------------- ### Mail RealIP Configuration Example Source: https://en.angie.software/angie/docs/configuration/modules/mail/mail_realip Example configuration for the RealIP module, enabling PROXY protocol and setting trusted IP addresses. ```nginx listen 110 proxy_protocol; set_real_ip_from 192.168.1.0/24; set_real_ip_from 192.168.2.1; set_real_ip_from 2001:0db8::/32; ``` -------------------------------- ### Configure Angie PRO Repository for AlmaLinux Source: https://en.angie.software/angie/docs/installation/pro_packages Sets up the Angie PRO repository configuration for AlmaLinux. Ensure the SSL certificate and key files are in place. ```ini [angie-pro] name=Angie PRO repo baseurl=https://download.angie.software/angie-pro/almalinux/$releasever/ sslclientcert=/etc/ssl/angie/angie-repo.crt sslclientkey=/etc/ssl/angie/angie-repo.key gpgcheck=1 enabled=1 gpgkey=https://angie.software/keys/angie-signing.gpg.asc ```