Deployment guide

Tengine

Overview

Tengine is a high-performance web server and reverse proxy that originated at Taobao (Alibaba Group) as a feature-enhanced fork of nginx. It stays 100% compatible with the nginx configuration language and behavior, so everything you already know about nginx.conf, server blocks and location blocks applies unchanged.

This SecureAnyCloud image ships Tengine 3.1.0 (base nginx 1.24.0) on Ubuntu 24.04 on Azure, compiled from the official source tarball with SSL, HTTP/2, real-IP, gzip-static, stub-status and sub-filter modules and hardened compiler flags. It boots with a production configuration rather than a bare default: the server version is hidden (server_tokens off) and only TLS 1.2 and 1.3 are accepted. HTTPS works out of the box because each VM generates its own self-signed certificate, private key and Diffie-Hellman parameters on the first boot. Nothing secret is baked into the image.

What you get:

  • Tengine 3.1.0 compiled from source to /usr/sbin/tengine, running as the tengine system user
  • A hardened /etc/tengine/tengine.conf: the server version is hidden (server_tokens off), only TLS 1.2 and 1.3 are accepted, HTTP/2 is on, gzip is enabled, common security headers are set and sessions are hardened
  • A default site at /etc/tengine/conf.d/default.conf serving the SecureAnyCloud landing page on TCP 80 and TCP 443
  • The document root at /var/www/html
  • A per-VM self-signed TLS certificate, key and DH parameters generated on the first boot in /etc/tengine/ssl/ (never shipped in the image)
  • A local-only stub_status health endpoint at /tengine_status (bound to 127.0.0.1)
  • A commented reverse-proxy location block, ready for you to point at an upstream
  • tengine.service and tengine-firstboot.service systemd units that start automatically on boot
  • Listeners on TCP 80 (HTTP) and TCP 443 (HTTP/2 + TLS)
  • An Ubuntu 24.04 LTS base with the latest security patches applied at build time and unattended-upgrades enabled
  • The Azure Linux Agent for cloud integration and SSH key injection
  • 24/7 SecureAnyCloud support with a guaranteed 24-hour response SLA

Prerequisites

  • An active Azure subscription
  • A subscription to the Tengine on Ubuntu 24.04 listing on Azure Marketplace
  • An SSH public key for VM authentication
  • A virtual network and subnet in the target region

Recommended virtual machine size: Standard_B2s (2 vCPU, 4 GB RAM) for typical web and reverse-proxy traffic. Tengine is efficient with a small memory footprint. Scale up only for very high request rates or large reverse-proxy fleets.

1

Deploy from the Azure Portal

Open the Marketplace in the Azure Portal and search for Tengine. Select the SecureAnyCloud publisher entry and click Create.

On the Networking tab, attach a network security group that allows inbound TCP 22 from your management IP range. Also allow TCP 80 and TCP 443 from the client networks that should reach your site.

Click Review + create, wait for validation, then click Create. Deployment takes around two minutes.

2

Deploy from the Azure CLI

Create a resource group and the VM:

RG="tengine-prod" LOCATION="eastus" VM_NAME="tengine-01" ADMIN_USER="azureuser" IMAGE_URN="sac1647283583153:tengine-ubuntu-24-04:default:latest" SSH_KEY="$(cat ~/.ssh/id_rsa.pub)" az group create --name "$RG" --location "$LOCATION"
# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:tengine-ubuntu-24-04:default:latest
az vm create \
  --resource-group "$RG" \
  --name "$VM_NAME" \
  --image "$IMAGE_URN" \
  --size Standard_B2s \
  --admin-username "$ADMIN_USER" \
  --ssh-key-values "$SSH_KEY" \
  --public-ip-sku Standard

Open the web ports on the VM's network security group. Adjust the source ranges to your own networks:

az network nsg rule create --resource-group "$RG" --nsg-name "${VM_NAME}NSG" \
  --name allow-http --priority 1001 --destination-port-ranges 80 --access Allow --protocol Tcp
az network nsg rule create --resource-group "$RG" --nsg-name "${VM_NAME}NSG" \
  --name allow-https --priority 1002 --destination-port-ranges 443 --access Allow --protocol Tcp
3

Verify the service is running

SSH to the VM and confirm that Tengine is active, enabled at boot, and listening on TCP 80 and 443. tengine-firstboot.service generates the self-signed certificate and DH parameters once, on the first boot.

systemctl status tengine --no-pager tengine -v ss -tln | grep -E ':80 |:443 '

Expected output:

● tengine.service - Tengine - high performance web server (sac) Loaded: loaded (/etc/systemd/system/tengine.service; enabled; preset: enabled) Active: active (running) Tengine version: Tengine/3.1.0 nginx version: nginx/1.24.0 LISTEN 0 511 0.0.0.0:80 0.0.0.0:* LISTEN 0 511 0.0.0.0:443 0.0.0.0:*
4

Review the build configuration

The image is compiled from the official Tengine source tarball. Inspect the exact modules and compiler flags it was built with, and confirm that the running configuration passes a syntax test:

tengine -V tengine -t

The build includes the SSL, HTTP/2, real-IP, stub-status, gzip-static and sub-filter modules, with stack-protector and RELRO hardening flags. tengine -t reports that the configuration syntax is OK.

5

Confirm the hardened defaults and TLS

Check that the server version is hidden, the security headers are present, the per-VM self-signed certificate is in place, and HTTP/2 is negotiated on TCP 443:

curl -sI http://localhost/ | grep -iE '^HTTP|^Server:|^X-|^Referrer' echo | openssl s_client -connect 127.0.0.1:443 2>/dev/null | openssl x509 -noout -subject -issuer -dates
curl -skI --http2 https://localhost/ | grep -iE '^HTTP|^strict-transport'

The output shows these results:

  • Server: Tengine appears with no version number (server_tokens off).
  • The X-Content-Type-Options, X-Frame-Options and Referrer-Policy headers are set.
  • The certificate is this VM's own self-signed certificate.
  • HTTP/2 200 confirms that HTTP/2 is active, with HSTS on HTTPS.

The default landing page is served from /var/www/html over both HTTP and HTTPS.

6

Serve your own website

Drop your files into the document root, or edit the default site. The document root is /var/www/html. List the files and review the default site:

ls -la /var/www/html/ cat /etc/tengine/conf.d/default.conf

To serve your own static site, replace the contents of /var/www/html. Then test the configuration and reload Tengine:

sudo tengine -t sudo systemctl reload tengine
7

Reverse-proxy an upstream application

Tengine works well as a reverse proxy and load balancer. The default site ships a commented location /app/ block. Uncomment it in /etc/tengine/conf.d/default.conf and point proxy_pass at your backend:

location /app/ { proxy_pass http://127.0.0.1:8080/; proxy_http_version 1.1; 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_set_header X-Forwarded-Proto $scheme; }

To load-balance across several backends, declare an upstream block and proxy to it:

upstream app_pool { server 10.0.0.4:8080; server 10.0.0.5:8080; } server { listen 80; location / { proxy_pass http://app_pool; } }

After you edit any configuration, validate it before you reload. A reload never drops live connections:

sudo tengine -t sudo systemctl reload tengine
8

Install a real TLS certificate

The image ships with a per-VM self-signed certificate so HTTPS works immediately. To serve a certificate that browsers trust, replace the two files referenced by the default :443 server block, then reload:

  • /etc/tengine/ssl/sac.crt: your certificate (full chain)
  • /etc/tengine/ssl/sac.key: your private key
ssl_certificate /etc/tengine/ssl/sac.crt; ssl_certificate_key /etc/tengine/ssl/sac.key;

Copy your certificate and key over those paths, keeping the key readable only by root. Then test the configuration and reload:

sudo tengine -t sudo systemctl reload tengine

For automated Let's Encrypt certificates, install certbot (sudo apt-get install -y certbot) and obtain a certificate in standalone or webroot mode. Point the ssl_certificate and ssl_certificate_key directives at the issued files and reload Tengine.

Tengine keeps the nginx configuration layout, so a renewal --deploy-hook of systemctl reload tengine keeps the served certificate current.

Security notes

  • No baked secret. The TLS private key, certificate and DH parameters are generated uniquely on every VM on the first boot in /etc/tengine/ssl/. The private key is mode 0600 root:root. No two instances share a key, and nothing secret ships in the image.
  • Version hidden. server_tokens off means responses carry a bare Server: Tengine header with no version, which reduces fingerprinting.
  • TLS 1.2 and 1.3 only. Session tickets are disabled, and HSTS is set on HTTPS responses.
  • Local-only status. The stub_status metrics endpoint at /tengine_status is restricted to 127.0.0.1.
  • Patched at build time. Unattended-upgrades stays enabled, so the VM keeps receiving OS security updates.

Support

  • Documentation and guides: secureanycloud.com
  • Email support: sales@secureanycloud.com (24/7, 24-hour response SLA)
  • Tengine project: tengine.taobao.org

Deploy on Azure

Launch Tengine on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.

View this image

Need Help?

Our support team is available 24/7.

sales@secureanycloud.com

Deploy on Azure