### Example Usage of Command Element Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/types.md Illustrates the usage of the `` element with a sample Nginx command. ```xml nginx -t ``` -------------------------------- ### Example Usage of Variable Element Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/types.md Provides examples of using the `` element for Nginx variables. ```xml $uri, $args ``` -------------------------------- ### Install Debian/Ubuntu Dependencies Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Installs essential and optional build tools on Debian/Ubuntu systems. ```bash sudo apt-get install build-essential perl libxslt1-tools libxml2-utils python3 # Optional sudo apt-get install netpbm rsync gnupg ``` -------------------------------- ### Initial Build in Docker Entrypoint Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-shell-tools.md Runs a complete site build using make when a Docker container starts. Requires 'make' and GNUmakefile. ```bash #!/bin/sh umask 002 exec /bin/sh "$@" ``` -------------------------------- ### Start Development Environment with Watch Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Command to start the Docker Compose development environment, enabling automatic rebuilds and file watching. ```bash # Start development environment with auto-rebuild docker compose up --build --watch # Access at http://localhost:8001/ ``` -------------------------------- ### Start Development Container with Docker Compose Source: https://github.com/nginx/nginx.org/blob/main/README.md Starts the development container using Docker Compose. The --watch flag rebuilds the site automatically on file changes. ```shell docker compose up --build --watch ``` -------------------------------- ### Example Usage of Path Element Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/types.md Shows an example of the `` element, including a nested `` element. ```xml /etc/nginx.conf ``` -------------------------------- ### Generate Site Content with Make Source: https://github.com/nginx/nginx.org/blob/main/README.md Generates the static HTML content for the website. This command should be run from the top-level directory after installing prerequisites. ```shell make ``` -------------------------------- ### Parallel Builds with Make Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Speeds up the build process by utilizing multiple parallel jobs with the 'make' command. The example uses 8 parallel jobs. ```bash make -j8 clean all gzip # 8 parallel jobs ``` -------------------------------- ### Install macOS Dependencies (Homebrew) Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Installs essential and optional build tools on macOS using Homebrew. ```bash brew install perl libxslt libxml2 python@3 # Optional brew install netpbm rsync gnupg ``` -------------------------------- ### Example Directive Usage Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/types.md Illustrates the usage of the directive element with its child elements like syntax, default, context, and appeared-in. ```xml server_name name ... server_name ""; server 0.6.4 Sets names for a virtual server... ``` -------------------------------- ### English Language Configuration Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Example GNUmakefile for English language configuration, defining top-level pages, documentation pages, reference pages, and FAQ pages. ```makefile TOP = about community DOCS = beginner install admin windows faq REFS = ngx_core http stream mail modules FAQ = faq beginner ``` -------------------------------- ### Example Usage of HTTP Status Element Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/types.md Shows an example of the `` element with code and text attributes. ```xml ``` -------------------------------- ### XML Element Definition for Example Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/types.md Defines the XML element for code examples or sample output. ```xml ``` -------------------------------- ### Example Usage of Link Element Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/types.md Demonstrates the usage of the `` element with attributes for cross-referencing. ```xml server_name directive ``` -------------------------------- ### XSLT Transformation Example Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md An example of using xsltproc to transform an XML file into an HTML file, specifying origin, available languages, a version parameter, and the stylesheet and input files. ```bash xsltproc \ --stringparam ORIGIN "en/docs/modules.xml" \ --stringparam TRANS "en ru fr" \ --stringparam VERSION "1.25.0" \ xslt/article.xslt xml/en/docs/modules.xml > libxslt/en/docs/modules.html ``` -------------------------------- ### Nginx Daemon for Development Site Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-shell-tools.md Starts the nginx server in the foreground to keep the Docker container running, making the development site accessible. Reads configuration from '/etc/nginx/conf.d/default.conf'. ```bash echo "NOTICE: nginx.org development site is running at http://localhost:8001/" exec nginx -g 'daemon off;' ``` -------------------------------- ### Russian Language Configuration Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Example GNUmakefile for Russian language configuration, specifying documentation pages and reference modules. ```makefile TOP = about community DOCS = beginner install admin windows faq REFS = ngx_core http stream mail modules FAQ = faq ``` -------------------------------- ### Get Legacy Version Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Retrieves the legacy version information using xsltproc. ```bash NGINX_LEGACY=$(xsltproc --stringparam VERSION legacy xslt/version.xslt xml/versions.xml) ``` -------------------------------- ### Add Custom Build Rule Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-shell-tools.md Define custom build rules by adding targets and dependencies to your GNUmakefile or language-specific Makefiles. This example shows how to create a custom HTML page from an XML source using a specific XSLT. ```makefile custom-build: libxslt/custom/page.html libxslt/custom/page.html: xml/custom/page.xml mkdir -p $(dir $@) $(call XSLT, xslt/article.xslt, $<, $@) ``` -------------------------------- ### Markdown to XML Conversion Example Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-yaml2xml.md Illustrates the conversion of markdown elements within YAML descriptions to nginx XML markup. This function handles code, emphasis, links, and bold text. ```python def node_description(node): # Extracts description field (returns empty string if missing) # Applies regex substitutions for each markdown pattern # Encodes to UTF-8 and returns stripped/decoded result pass ``` -------------------------------- ### Invoking JPEG Normalization Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-shell-tools.md Example of invoking the JPEGNORM macro to process an image for the Nginx cookbook. ```makefile binary/books/nginx_cookbook.jpg: sources/B05431_0.jpg mkdir -p $(dir $@) $(call JPEGNORM, $<, $@) ``` -------------------------------- ### Article Root Element Definition Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/types.md Defines a general article or documentation page. Used for general content pages, introductions, and guides. ```xml ``` -------------------------------- ### Get Mainline Nginx Version Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Bash command to extract the mainline Nginx version from the versions.xml file using xsltproc. ```bash # Get mainline version NGINX_VERSION=$(xsltproc xslt/version.xslt xml/versions.xml) ``` -------------------------------- ### Production Dockerfile Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Dockerfile for production builds, including build and runtime stages. It installs necessary packages, copies project files, builds images, and exposes port 8080. ```dockerfile FROM nginx:alpine AS build RUN apk add netpbm perl perl-parse-recdescent libxslt libxml2-utils patch make rsync # Build stage COPY . /var/www WORKDIR /var/www RUN make images all gzip # Runtime stage FROM nginx:alpine COPY --from=build /var/www /var/www COPY docker-nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 8080 ``` -------------------------------- ### XSLScript Stylesheet Example Source: https://github.com/nginx/nginx.org/blob/main/tools/xslscript.txt Defines templates for a poem, including title, author, stanza, line, and date. Uses XSLScript syntax for templates, applying templates, and conditional logic. ```XSLScript X:stylesheet { X:template = "poem" { !{title} !! "title"; !! "author"; X:apply-templates "stanza"; X:apply-templates "date"; } X:template = "title" {

!{.}

} X:template = "author" {

By <% !{.} %>

} X:template = "stanza" {

!! "line";

} X:template = "line" { X:if "position() mod 2 = 0" {  } !{.}
} X:template = "date" {

!{.}

} } ``` -------------------------------- ### Get Stable Nginx Version Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Bash command to extract the stable Nginx version from the versions.xml file using xsltproc with a string parameter. ```bash # Get stable version NGINX_STABLE=$(xsltproc --stringparam VERSION stable xslt/version.xslt xml/versions.xml) ``` -------------------------------- ### Production Docker Build Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-shell-tools.md Dockerfile for building the production version of the Nginx.org site. It includes installing dependencies, applying patches, compiling the site, and copying assets to the final Nginx image. ```dockerfile FROM nginx:alpine AS build RUN apk add netpbm perl perl-parse-recdescent libxslt libxml2-utils patch make rsync COPY . /var/www WORKDIR /var/www COPY *.patch . RUN touch null.patch && cat *.patch | patch -p1 RUN make images all gzip FROM nginx:alpine COPY --from=build /var/www /var/www COPY docker-nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 8080 ``` -------------------------------- ### Production Environment Build and Deploy Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Executes a complete build with all optimizations, including gzip compression, and then deploys the artifacts to the production server. ```bash # Complete build with all optimizations make clean images all gzip # Deploy to production make NGINX_ORG=/var/www/nginx.org copy ``` -------------------------------- ### Build nginx.org Website with Make Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/INDEX.md Build the entire nginx.org website, specify languages, use parallel builds, or perform a clean rebuild. ```bash make all # Build all HTML ``` ```bash make LANGS=en all # Single language ``` ```bash make -j4 all # Parallel build ``` ```bash make clean all # Clean rebuild ``` -------------------------------- ### Clone and Set Up nginx.org Repository Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/INDEX.md Clone the nginx.org repository and set up the development environment using Docker Compose or a native build. ```bash # Clone repository git clone https://github.com/nginx/nginx.org.git cd nginx.org # Docker Compose (recommended) docker compose up --build --watch # Or native build make clean all ``` -------------------------------- ### Full Production Build Command Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-build-system.md Executes a full production build, including generating image thumbnails, building all HTML content, and creating gzip-compressed versions of files. ```bash make images all gzip ``` -------------------------------- ### Build Pipeline: XML to HTML Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/architecture.md Illustrates the data flow for building HTML output from XML source, including validation and optional Gzip compression. ```text XML Source ↓ [Validation via xmllint + DTD] ↓ XSLT Transformation ↓ HTML Output ↓ [Optional: Gzip compression] ↓ libxslt/ (uncompressed) gzip/ (compressed) ``` -------------------------------- ### Development Environment Build Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Performs a quick build for the development environment, skipping gzip compression and optionally limiting languages for faster iteration. ```bash # Quick rebuild, skip gzip make OUT=./libxslt all # Limit languages for faster iteration make LANGS=en all ``` -------------------------------- ### Multi-Language Release Deployment Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Builds and deploys the Nginx site including all specified language versions, with optimizations. This command builds all components, compresses them, and copies them to the deployment location. ```bash make LANGS='en ru' clean all gzip copy ``` -------------------------------- ### Build with Custom XSLScript Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-shell-tools.md Use this command to build the project with a custom XSLScript. Ensure the custom script is located at the specified path. ```bash make XSLS=/custom/path/xslscript.pl all ``` -------------------------------- ### Production Release Deployment Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Builds the complete Nginx site with all optimizations, including gzip compression, and deploys it to production. Includes verification steps and an option for signing releases. ```bash # Build with all optimizations make clean images all gzip # Deploy to production make NGINX_ORG=/var/www/nginx.org copy # Verify deployment curl https://nginx.org/ # If using signed releases: make stable ``` -------------------------------- ### Deploy to Staging Command Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-build-system.md Deploys the draft version of the website to a staging environment using `rsync`. This command is typically run on a production host. ```bash make draft ``` -------------------------------- ### Production Deployment Commands Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/INDEX.md A sequence of commands for a complete production build, including compression and deployment to production servers. ```bash make clean images all gzip copy ``` -------------------------------- ### Configure Build Output Path and Languages Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/INDEX.md Customize the build output directory and specify which languages to build. ```bash make OUT=/custom/path all ``` ```bash make LANGS=en all ``` -------------------------------- ### Build Target Dependencies: Homepage Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/architecture.md Specifies the dependencies for building the homepage, including XML source files and article-specific dependencies. ```makefile homepage ($(OUT)/index.html) ├─ xml/homepage.xml ├─ xml/index.xml └─ ARTICLE_DEPS ``` -------------------------------- ### Staging Deployment Configuration Variables Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Defines configuration variables for staging deployment, including deployment targets, directories, and rsync/chmod options. ```makefile NGINX_ORG = /data/www/nginx.org # Deployment target OUT = libxslt # HTML directory TEXT = text # Text directory IMG = img # Images directory RSYNC = rsync -v -rpc # Rsync options CHMOD = /bin/chmod -R g=u # Permission setting ``` -------------------------------- ### Build System Performance Optimization Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/architecture.md Provides commands to optimize the build process by utilizing parallel make, skipping gzip compression for faster development, or performing selective language rebuilds. ```makefile make -j4 make all make en ``` -------------------------------- ### Build HTML Only for Staging Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Builds only the HTML content for staging, skipping the compression step. ```bash make OUT=/staging/html all ``` -------------------------------- ### XSLScript Transformation Example with Recursion Source: https://github.com/nginx/nginx.org/blob/main/tools/xslscript.txt Defines a recursive template 'max' to find the maximum value in a list based on a condition. The root template '/' applies this to find the longest speech. ```XSLScript X:transform { X:template max( list ) { X:if "$list" { X:variable first="count($list[1]/LINE)" X:variable max-of-rest={ !max( list="$list[position()!=1]" ) } X:if "$first > $max-of-rest" { !{$first} } else { !{$max-of-rest} } } else { 0 } } X:template ="/" { Longest speech is <% X:text; !max( list="//SPEECH" ) X:text; %> lines. } } ``` -------------------------------- ### Build Target Dependencies: Language-Specific Outputs Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/architecture.md Describes the structure and dependencies for language-specific outputs, including top pages, documentation, and FAQ. ```makefile en/ru (language-specific) ├─ TOP pages ($(OUT)/$(lang)/index.html) ├─ DOCS pages ($(OUT)/$(lang)/docs/index.html) │ ├─ Individual doc HTML files │ └─ Generated indices (dirindex, varindex) └─ FAQ ($(OUT)/$(lang)/docs/faq.html) ``` -------------------------------- ### Builder Loop for Rebuilding on Changes Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-shell-tools.md Polls for a trigger file and rebuilds the site using 'make' when changes are detected. Includes debouncing to handle rapid file modifications. ```bash while true; do if [ -f "$TRIGGER" ]; then sleep 1.0 # Debounce rapid changes rm -f "$TRIGGER" echo "Changes detected. Rebuilding..." make -C /var/www || echo "Build failed. Fix the errors to trigger a rebuild." else sleep 1.0 # Polling interval fi done & ``` -------------------------------- ### Production Deployment Copy Process Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md The makefile rule for copying and syncing production artifacts, including gzip archives, binaries, and language-specific directories. ```makefile copy: $(CHMOD) $(ZIP) binary # Set permissions $(RSYNC) $(ZIP)/ binary/ # Deploy gzip + binaries $(RSYNC) --delete # Sync language directories $(foreach lang, $(LANGS), $(ZIP)/$(lang)) ``` -------------------------------- ### Sign Release Packages (Legacy Release) Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Builds and signs the legacy release packages. ```bash make legacy ``` -------------------------------- ### Deployment Verification (HTTP Headers) Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Verifies deployment by checking production files using curl and confirming compression by checking for the 'Content-Encoding: gzip' header when requesting a compressed resource. ```bash curl -I https://nginx.org/ curl -I https://nginx.org/en/docs/ curl -H "Accept-Encoding: gzip" -I https://nginx.org/ # Should have Content-Encoding: gzip header ``` -------------------------------- ### Single Language Build for Testing Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Builds the Nginx site for a single specified language, useful for fast iteration during testing. Can build all specified languages or a specific one. ```bash make LANGS=en all # Or specific language: make en ``` -------------------------------- ### Build Target Dependencies: News Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/architecture.md Lists the dependencies required for building the news page and its associated RSS feed. ```makefile news ($(OUT)/news.html, index.rss) ├─ xml/index.xml └─ NEWS_DEPS ``` -------------------------------- ### Deploy nginx.org Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/INDEX.md Commands for deploying the nginx.org site to development, staging, or production environments. ```bash # Development environment docker compose up --build --watch # Staging deployment make draft # Production deployment make clean images all gzip copy ``` -------------------------------- ### Build Docker Image for nginx.org Source: https://github.com/nginx/nginx.org/blob/main/README.md Builds a Docker image for the nginx.org website. Use --no-cache to ensure a clean build. ```shell docker build --no-cache -t nginx.org:my_build . ``` -------------------------------- ### Sign Release Packages (Custom Version) Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Builds and signs release packages for a custom specified version. ```bash make any NGINX=0.7.69 make sign ``` -------------------------------- ### Verify Pre-compression Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Lists the details of pre-compressed files. This command is typically run after 'make gzip' to verify the output. ```bash # Already done by 'make gzip' target ls -lh gzip/index.html* ``` -------------------------------- ### Staging Verification Deployment Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Performs a clean build of all Nginx components and then builds the draft version for testing on a staging server. Verification is done by accessing http://staging.nginx.org/. ```bash make clean all make draft # Verify at http://staging.nginx.org/ ``` -------------------------------- ### Test nginx.org Build Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/INDEX.md Perform quick validation of the build or a full validation including compression and thumbnails. ```bash # Quick validation make all # Full validation (with compression, thumbnails) make images all gzip ``` -------------------------------- ### Archive Old Releases Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Moves the current libxslt directory to an archive with a timestamp and then runs the 'make copy' command. ```bash mv /var/www/nginx.org/libxslt /var/www/nginx.org/libxslt-$(date +%Y%m%d) make copy ``` -------------------------------- ### Build Target Dependencies: All Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/architecture.md Defines the top-level 'all' build target and its dependencies, including homepage, news, archives, CSS, and language-specific outputs. ```makefile all → homepage, news, arx, 404, css, en, ru ``` -------------------------------- ### Makefile for Signing Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md The Makefile target for signing release archives using GPG. Requires a configured GPG private key and password. ```makefile sign: @echo sign nginx-$(NGINX) gpg -sab binary/download/nginx-$(NGINX).tar.gz gpg -sab binary/download/nginx-$(NGINX).zip ``` -------------------------------- ### Sign Release Packages (Dev Release) Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Builds and signs the development release packages for the mainline version. ```bash make dev ``` -------------------------------- ### Custom Deployment Target for Staging Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Performs a staging deployment to a custom deployment target directory. ```bash make NGINX_ORG=/var/www/staging draft ``` -------------------------------- ### Clean and Rebuild Command Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-build-system.md First, cleans the build environment by removing generated files, then rebuilds all content using the `all` target. ```bash make clean make all ``` -------------------------------- ### XSLScript Compilation Options Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Demonstrates different command-line options for the xslscript.pl tool, including standard compilation, debug mode, and parser tracing. ```bash perl tools/xslscript.pl -o output.xslt input.xsls # Standard perl tools/xslscript.pl --dump input.xsls # Debug mode (parse tree) perl tools/xslscript.pl --trace input.xsls # Parser trace ``` -------------------------------- ### Selective Builds with Make Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Performs selective builds using the 'make' command to skip specific operations or build only certain languages. Useful for faster builds or smaller output sizes. ```bash # Without images (fastest) make all # Without gzip (faster, smaller size) make all # Only one language make LANGS=en all ``` -------------------------------- ### Build Target Dependencies: Archives Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/architecture.md Details the dependencies for building the news archive pages, which are generated per year. ```makefile arx ($(OUT)/YYYY.html for each year) ├─ xml/index.xml └─ NEWS_DEPS ``` -------------------------------- ### Production Host Detection Logic Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Makefile snippet for detecting production hostnames and enabling specific build and deployment targets. ```makefile ifeq ($(patsubst %.nginx.com,YES,$(shell hostname)), YES) all: images # Generate thumbnails all: dir.map # Generate directive map copy: copy_dirmap # Deploy directive map endif ``` -------------------------------- ### Backup Production Files Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Creates a compressed tar archive of the production libxslt directory for backup purposes. The filename includes the current date. ```bash tar czf backup-$(date +%Y%m%d).tar.gz /var/www/nginx.org/libxslt/ ``` -------------------------------- ### Build with Language Filter for Staging Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Builds staging content with a specified language filter. ```bash make LANGS=en draft ``` -------------------------------- ### Build with Custom Shell Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-shell-tools.md Specify a custom shell for the build process. This is useful if your environment requires a specific shell interpreter. ```bash make SHELL=/usr/bin/bash all ``` -------------------------------- ### Enable Make Verbose Output Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-shell-tools.md Command to enable verbose output for make commands, showing full command execution for each build rule. ```bash make V=1 all ``` -------------------------------- ### ARTICLE_DEPS Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-build-system.md Lists dependencies for article, module, and documentation transformations. These include common dependencies plus specific XML, DTD, and XSLT files. ```makefile $(COMMON_DEPS) xml/versions.xml dtd/article.dtd dtd/module.dtd xslt/article.xslt xslt/books.xslt xslt/directive.xslt xslt/donate.xslt xslt/download.xslt xslt/security.xslt xslt/versions.xslt xslt/projects.xslt ``` -------------------------------- ### Build Gzip Archive Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Command to build a gzip archive of the website content. This process syncs content, generates .gz files, preserves timestamps, and ensures no orphaned .gz files remain. ```bash make gzip ``` -------------------------------- ### Docker Compose Development Environment Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Sets up a development environment for Nginx using Docker Compose. It includes port mapping, file synchronization for development, and volume mounts for configuration. ```yaml services: nginx.org: ports: - 8001:8080 # localhost:8001 → container:8080 build: dockerfile: dev.Dockerfile develop: watch: - path: ./xml target: /var/www/xml action: sync - path: ./xsls target: /var/www/xsls action: sync - path: ./css target: /var/www/libxslt/css action: sync tmpfs: - /var/www/xslt # In-memory XSLT directory volumes: - ./docker-nginx.conf:/etc/nginx/conf.d/default.conf - ./xslt/version.xslt:/var/www/xslt/version.xslt ``` -------------------------------- ### Build Validation Script Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Checks for build errors by running 'make all' and capturing the exit code. If the build fails, it prints 'Build failed' and displays the build log. Also validates HTML output using xmllint and checks file sizes. ```bash make all > build.log 2>&1 exitcode=$? if [ $exitcode -ne 0 ]; then echo "Build failed" cat build.log fi for f in libxslt/**/*.html; do xmllint --noout "$f" || echo "Invalid: $f" done du -sh libxslt/ du -sh gzip/ ``` -------------------------------- ### Mount Custom Nginx Configuration Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-shell-tools.md Configure Nginx with custom settings by mounting a local configuration file into the container. This allows for tailored Nginx behavior. ```yaml volumes: - ./my-nginx.conf:/etc/nginx/conf.d/default.conf ``` -------------------------------- ### Custom Rsync Options for Deployment Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Configure custom rsync options for deployment tasks by overriding the RSYNC Make variable. ```bash make RSYNC='rsync -avz --delete' draft ``` -------------------------------- ### Development Docker Build Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-shell-tools.md Dockerfile for building the development version of the Nginx.org site. It includes development tools, an initial build, and an entrypoint script for auto-rebuilding. ```dockerfile FROM nginx:alpine RUN apk add netpbm perl perl-parse-recdescent libxslt libxml2-utils \ inotify-tools make rsync bash COPY . /var/www WORKDIR /var/www RUN make # Initial build ENTRYPOINT ["./tools/entrypoint.sh"] ``` -------------------------------- ### YAML to XML Converter Usage Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/INDEX.md Use this Python script to convert YAML formatted API documentation into XML. ```bash python yaml/yaml2xml.py input.yaml ``` -------------------------------- ### CI/CD Build and Validation Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Builds and validates the project in a CI/CD environment, checking for errors and compressing artifacts for archival. ```bash # Build and validate make all exitcode=$? # Check for errors if [ $exitcode -ne 0 ]; then echo "Build failed" exit 1 fi # Compress for archival make gzip ``` -------------------------------- ### Language Directory Structure Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/architecture.md Illustrates the parallel directory structure for each language within the project, including build configurations, index files, and documentation subdirectories. ```plaintext xml/ ├── [common files] └── LANG/ ├── GNUmakefile # Language build configuration ├── index.xml # Language homepage ├── [top-level pages] # As configured in GNUmakefile TOP └── docs/ ├── index.xml # Docs index ├── [documentation pages] # As configured in GNUmakefile DOCS ├── [reference modules] # As configured in GNUmakefile REFS ├── dirindex.xml # Auto-generated (if in DOCS) └── varindex.xml # Auto-generated (if in DOCS) ``` -------------------------------- ### Selective Language Build Command Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-build-system.md Builds content for a specific language only. Replace `en` or `ru` with the desired language code. ```bash make en make ru ``` -------------------------------- ### YAML API Documentation to HTML Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/architecture.md Outlines the conversion process from OpenAPI YAML definitions to nginx XML format, followed by standard XSLT processing to generate HTML documentation. ```text yaml/nginx_api.yaml (OpenAPI) ↓ [yaml2xml.py converter] ↓ xml/en/docs/api.xml (nginx XML) ↓ [Standard XSLT processing] ↓ libxslt/en/docs/api.html ``` -------------------------------- ### Emergency Hotfix Deployment (rsync) Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Deploys a single-page fix to production using rsync. This involves editing the source file, rebuilding only that page, and then deploying the updated file. Includes steps for both uncompressed and gzip deployments. ```bash # Edit source file vim xml/en/docs/install.xml # Rebuild only that page make libxslt/en/docs/install.html # Deploy (if using rsync): rsync -v libxslt/en/docs/install.html $(NGINX_ORG)/libxslt/en/docs/ # For gzip deployment: make libxslt/en/docs/install.html.gz rsync -v libxslt/en/docs/install.html.gz $(NGINX_ORG)/gzip/en/docs/ ``` -------------------------------- ### GitHub Actions Build Matrix Configuration Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Configures a build matrix in GitHub Actions to test multiple language and target combinations. ```yaml strategy: matrix: languages: [[en], [ru], [en, ru]] target: [all, gzip] ``` -------------------------------- ### Force Rebuild Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Cleans the build artifacts and then performs a full rebuild. ```bash make clean all ``` -------------------------------- ### Render OpenAPI Document to XML Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-yaml2xml.md Processes a complete parsed OpenAPI document into the nginx XML documentation format. ```python def render_doc(doc): # Input: Complete parsed YAML document (dict) # Returns: XML string # Process: # 1. Creates root '
' # 2. Calls render_paths(doc) to process all endpoints # 3. Calls render_defs(doc) for schema definitions # 4. Returns formatted XML pass ``` -------------------------------- ### NEWS_DEPS Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-build-system.md Lists dependencies for news, index, and RSS transformations. This set includes common dependencies along with specific DTD and XSLT files for news content. ```makefile $(COMMON_DEPS) dtd/news.dtd xslt/news.xslt ``` -------------------------------- ### Verbose Build Output Command Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-build-system.md Runs the build process with verbose output enabled by setting the `V=1` variable. This provides detailed logging for debugging purposes. ```bash make V=1 ``` -------------------------------- ### Staging Deployment Hook Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md A deployment hook script executed on the production host for staging deployments. ```bash /usr/local/bin/copy_draft.sh $(NGINX_ORG) ``` -------------------------------- ### YAML to XML Converter Build Rule Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md A GNUmakefile rule to convert an OpenAPI 3.0 YAML specification into nginx-format XML documentation using a Python script. ```makefile genapi: python yaml/yaml2xml.py < yaml/nginx_api.yaml > xml/en/docs/api.xml ``` -------------------------------- ### Multiple Make Variable Overrides Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Apply multiple Make variable overrides simultaneously for custom build configurations. ```bash make OUT=/tmp NGINX_ORG=/var/www all ``` -------------------------------- ### Nginx Server Configuration Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Configures an Nginx server to listen on a specific port, handle static gzip compression, and serve content from different directories based on the request location. ```nginx server { listen 8080; gzip_static on; access_log /dev/stdout; default_type text/plain; location /img/ { root /var/www; } location /books/ { root /var/www/binary; } location = /favicon.ico { root /var/www/binary; } location / { if ( -d /var/www/gzip ) { root /var/www/gzip; # Use pre-compressed files if available } root /var/www/libxslt; # Fallback to uncompressed } } ``` -------------------------------- ### XSLScript Command-Line Invocation Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-xslscript.md Basic command to run the XSLScript tool. Specify options and an input file for conversion. ```bash perl tools/xslscript.pl [OPTIONS] [input_file] ``` -------------------------------- ### Check Rebuild Logs Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-shell-tools.md Command to check the last build status in a development container by examining the timestamps of output files. ```bash # Check last build status ls -lt /var/www/libxslt/ ``` -------------------------------- ### Nginx Configuration for Static Gzip Serving Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Nginx configuration block enabling static gzip serving. It prioritizes serving pre-compressed files from a 'gzip/' directory if available and the client accepts gzip encoding, falling back to uncompressed files otherwise. ```nginx location / { if ( -d /var/www/gzip ) { root /var/www/gzip; # Serve pre-compressed files } root /var/www/libxslt; } gzip_static on; # Enable static gzip serving ``` -------------------------------- ### Deployment Validation Script Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-shell-tools.md A bash script to validate deployment artifacts. It checks file sizes, the number of HTML files, and the presence of essential CSS files. ```bash #!/bin/bash # Check file sizes du -sh libxslt/ | grep -q "[0-9]" || { echo "No output"; exit 1; } # Check gzip [ $(find libxslt -name "*.html" | wc -l) -gt 100 ] || { echo "Insufficient HTML files"; exit 1; } # Check CSS [ -f libxslt/css/style.css ] || { echo "Missing CSS"; exit 1; } echo "Deployment validation passed" ``` -------------------------------- ### Restore Previous Version Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Restores a previously backed-up version of the website from a tar archive and reloads the Nginx service. ```bash tar xzf backup-20260527.tar.gz -C / systemctl reload nginx ``` -------------------------------- ### XSLScript Basic Instruction Syntax Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-xslscript.md Defines the general structure for XSLScript instructions with attributes and body content. ```xslscript X:instruction attribute="value" { body content } ``` -------------------------------- ### Check Gzip Files Count Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Counts the number of .gz files present in the gzip deployment directory to verify the compression deployment. ```bash find /var/www/nginx.org/gzip -name "*.gz" | wc -l ``` -------------------------------- ### Parallel Make Compilation Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Enables parallel compilation using the 'make -j' option to speed up build times. The number of jobs should ideally match the number of CPU cores. ```bash make -j4 all # Use 4 parallel jobs make -j8 gzip # 8 jobs for compression ``` -------------------------------- ### XSLScript Compilation Invocation Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Shows how to invoke the XSLScript compilation macro with input and output file arguments. ```makefile # Invocation: $(call XSLScript, input.xsls, output.xslt) ``` -------------------------------- ### XSLScript Parse Tree Structure for Instructions Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-xslscript.md Illustrates the internal representation of XSLScript instructions within the parse tree. ```perl ["X:instruction_name", attr1, value1, attr2, value2, ...] ``` -------------------------------- ### Convert YAML to XML Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-yaml2xml.md Invokes the YAML to XML converter using the build system. Input is read from stdin or a file, and output is redirected to stdout or a file. ```bash python yaml/yaml2xml.py < yaml/nginx_api.yaml > xml/en/docs/api.xml ``` -------------------------------- ### Production Docker Build Command Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md Command to build the production Docker image for nginx.org, ensuring no cache is used. ```bash docker build --no-cache -t nginx.org:latest . ``` -------------------------------- ### Module Root Element Definition Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/types.md Defines nginx module reference documentation, including directives, blocks, and contexts. Used for module reference pages. ```xml ``` -------------------------------- ### Retrieve Definition Object from Reference Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-yaml2xml.md Retrieves the actual schema definition object from the OpenAPI document using a $ref object. ```python def node_from_ref(doc, obj): # Parameters: # - doc (dict) — Complete OpenAPI document # - obj (dict) — Object with '$ref' key # Returns: Referenced definition from doc['definitions'][name] pass ``` -------------------------------- ### Multi-Language Build Flow Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/architecture.md Shows the parallel processing of XML source for different languages (English and Russian) and the subsequent parallel XSLT processing to generate language-specific HTML. ```text ┌─→ xml/en/docs/ XML Source ─────┤ [english content] │ └─→ xml/ru/docs/ [russian content] ↓ [Parallel XSLT processing] ↓ libxslt/en/docs/ libxslt/ru/docs/ ``` -------------------------------- ### Project Listing Element Definition Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/types.md Defines the XML structure for listing related projects, including attributes for title, documentation URL, repository URL, logo, and description. ```xml ``` -------------------------------- ### Nginx Version Configuration XML Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/configuration.md XML file defining Nginx version information, including mainline, stable, and legacy versions, used for build processes and signing downloads. ```xml 1.27.0 1.26.0 1.24.0 ``` -------------------------------- ### Pattern Rule: CSS Copy Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/architecture.md A simple pattern rule to copy CSS files from their source directory to the output directory. ```makefile $(OUT)/css/%.css ← css/%.css ↓ cp (copy) ``` -------------------------------- ### Makefile Integration for YAML to XML Conversion Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-yaml2xml.md This Makefile rule invokes the Python script `yaml2xml.py` to convert an OpenAPI YAML file into an XML file, which is then used in the documentation build. ```makefile genapi: python yaml/yaml2xml.py < yaml/nginx_api.yaml > xml/en/docs/api.xml ``` -------------------------------- ### Edit and Rebuild nginx.org Content Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/INDEX.md Edit XML content files and observe auto-rebuilds via Docker Compose file watchers or manually rebuild the site. ```bash # Edit XML files in xml/en/ or xml/ru/ vim xml/en/docs/install.xml # Auto-rebuild via docker compose file watchers # Or manually rebuild make all # View at http://localhost:8001/ ``` -------------------------------- ### Docker Compose Development Configuration Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-deployment.md Configuration for the Docker Compose development environment, specifying ports, build context, file watching, and volume mounts. ```yaml services: nginx.org: ports: - 8001:8080 build: dockerfile: dev.Dockerfile develop: watch: - path: ./xml target: /var/www/xml action: sync - path: ./xsls target: /var/www/xsls action: sync - path: ./css target: /var/www/libxslt/css action: sync tmpfs: - /var/www/xslt volumes: - ./docker-nginx.conf:/etc/nginx/conf.d/default.conf - ./xslt/version.xslt:/var/www/xslt/version.xslt ``` -------------------------------- ### Compile XSLScript to XSLT Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/INDEX.md Use the XSLScript tool to compile input XSLScript files into output XSLT stylesheets. ```bash perl tools/xslscript.pl -o output.xslt input.xsls ``` -------------------------------- ### Sign Stable Release Command Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/INDEX.md This command is used to sign a stable release, typically after all other production steps are completed. ```bash make stable ``` -------------------------------- ### COMMON_DEPS Source: https://github.com/nginx/nginx.org/blob/main/_autodocs/api-reference-build-system.md Lists files required by all transformations in the build system. Ensure these files are present before running any build target. ```makefile xml/banner.xml xml/menu.xml xml/i18n.xml dtd/content.dtd xslt/dirname.xslt xslt/link.xslt xslt/style.xslt xslt/body.xslt xslt/menu.xslt xslt/content.xslt ```