Migrating from nginx#
This guide replaces a packaged nginx with a packaged Angie on the same host,
keeping the configuration, virtual hosts, dynamic modules, and certificates. It
assumes nginx was installed from a distribution package with its configuration
in Install Angie from the official packages for your
distribution, but skip the start and enable steps: nginx still holds ports 80
and 443. On Debian and Ubuntu the package starts the service by itself, and that
attempt fails to bind while nginx is running; the failure is expected and does
not affect the installation. Confirm the binary: The packages put the configuration in The steps below use rsync; install its package if the command is
missing. Copy the entire nginx configuration to The Rename the main configuration file as Angie expects: Update the paths throughout the Angie configuration, starting with the main
file. At minimum: Any include paths that still point to The pid path, which the packaged service unit expects at
The access log and error log paths: If virtual hosts are included from List the originals and note where they point: Here it is Then recreate each symlink against the Angie copy: Find the dynamic modules the nginx configuration loads: For popular third-party modules Angie ships packages: A relative load_module path such as
Distributions wire the module configuration in one of two ways: If dynamic modules are included via Then copy the module configuration files: If dynamic modules are included via
List the originals and note where they point: Here it is Finally, recreate each symlink: Angie deprecates a few nginx directives and omits a few others. If your
configuration relies on any of them, see Unsupported nginx Directives. An
omitted directive makes The one most likely to appear in an existing configuration is nginx's
This step applies only if root points to Then update the directive: The user directive names the account the worker processes run as. The
Angie packages create an The master process parses the configuration and reads certificates and keys as
If the configuration has root directives pointing elsewhere, change the
owner of those directories too: Look for anything still pointing at nginx: Review each hit. Comments and the stock parameter files
( Check that Angie accepts the configuration: The command loads the dynamic modules and parses every included file; fix each
reported error and re-run until the test passes. To minimize downtime, start Angie immediately after stopping nginx: Enable the service so that it starts after a reboot: Confirm that the answer now comes from Angie: Once Angie has run without problems, disable nginx so that it does not reclaim
ports 80 and 443 after a reboot: If Certbot managed the certificates for nginx, it keeps working with Angie once
it is pointed at the new layout. The certbot nginx plugin looks for Create the file name the plugin expects: Re-run the plugin for the existing domains, naming Angie's server root and
binary; certbot stores these parameters with the certificate and
reuses them at renewal: Verify that a renewal would succeed: Renewals continue through Certbot's own timer. Angie obtains and renews certificates itself, without an external client:
Automatic HTTPS shows the configuration, and
Migrating from certbot covers replacing an existing Certbot setup. Features nginx does not have, in the open-source and the commercial
version. Automatic HTTPS and the statistics API on a small example. The reference for every directive and variable, grouped by module. Step-by-step guides for specific tasks: SSL, OIDC, clustering,
monitoring dashboards, and custom metrics./etc/nginx/, and that Angie comes from the official packages. Most nginx directives work in Angie unchanged; the
exceptions are listed in Unsupported nginx Directives and handled below.
Containers and builds with custom paths need adjustments
this guide does not cover.Installing Angie#
$ angie -v
Angie version: Angie/1.12.2
/etc/angie/ —
angie.conf alongside the http.d/ and stream.d/
directories and a modules/ link to the module directory — and the logs
in /var/log/angie/.Copying and Adapting the Configuration#
/etc/angie/:$ sudo rsync -a --no-links /etc/nginx/ /etc/angie/
--no-links option skips symlinks, reporting each one it passes
over; you recreate the ones in sites-enabled/ and
modules-enabled/ below, and a link whose target lies outside
/etc/nginx/ needs its target copied separately.$ sudo mv /etc/angie/nginx.conf /etc/angie/angie.conf
/etc/nginx/:# include /etc/nginx/conf.d/*.conf;
# include /etc/nginx/default.d/*.conf;
# include /etc/nginx/http.d/*.conf;
# include /etc/nginx/stream.d/*.conf;
include /etc/angie/conf.d/*.conf;
include /etc/angie/default.d/*.conf;
include /etc/angie/http.d/*.conf;
include /etc/angie/stream.d/*.conf;
# include /etc/nginx/sites-enabled/*;
include /etc/angie/sites-enabled/*;
# include /etc/nginx/modules-enabled/*.conf;
include /etc/angie/modules-enabled/*.conf;
# include /etc/nginx/mime.types;
include /etc/angie/mime.types;
/run/angie.pid:# pid /var/run/nginx.pid;
# -- or --
# pid /run/nginx.pid;
pid /run/angie.pid;
# access_log /var/log/nginx/access.log;
access_log /var/log/angie/access.log;
# error_log /var/log/nginx/error.log;
error_log /var/log/angie/error.log;
Virtual Hosts#
sites-enabled/, the include already
points at /etc/angie/ and the files themselves are already copied, but
not the symlinks, which --no-links skipped. Recreate them.$ ls -l /etc/nginx/sites-enabled/
default -> /etc/nginx/sites-available/default
/etc/nginx/sites-available/, inside /etc/nginx/, so
the Angie copy is already in place. If a target lies outside that directory,
copy it into /etc/angie/ as well.$ sudo ln -s /etc/angie/sites-available/default \
/etc/angie/sites-enabled/default
Dynamic Modules#
$ sudo nginx -T | grep load_module
load_module modules/ngx_http_geoip2_module.so;
load_module modules/ngx_stream_geoip2_module.so;
...
angie-module-name
for Angie and angie-pro-module-name for Angie PRO; here
angie-module-geoip2 provides both files. Check the
package list and install one for every module
the command lists; a module that is not in the list must be built for Angie.modules/ngx_http_geoip2_module.so resolves against the prefix
/etc/angie, where modules links to the package's module
directory, so it needs no change. An absolute nginx path does: rewrite it to
/usr/lib/angie/modules/ on Debian and Ubuntu, or
/usr/lib64/angie/modules/ on the RHEL family. Whichever layout you have,
rewrite the absolute paths in the module configuration files you copy below./usr/share/nginx/modules/,
update the path:# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
# include /usr/share/nginx/modules/*.conf;
include /usr/share/angie/modules/*.conf;
$ sudo rsync -a /usr/share/nginx/modules/ /usr/share/angie/modules/
/etc/nginx/modules-enabled/, the include already points at
/etc/angie/. Recreate the symlinks that --no-links
skipped.$ ls -l /etc/nginx/modules-enabled/
mod-http-geoip2.conf -> /usr/share/nginx/modules-available/mod-http-geoip2.conf
/usr/share/nginx/modules-available/, outside
/etc/nginx/, so copy that directory as well:$ sudo rsync -a /usr/share/nginx/modules-available/ /usr/share/angie/modules-available/
$ sudo ln -s /usr/share/angie/modules-available/mod-http-geoip2.conf \
/etc/angie/modules-enabled/mod-http-geoip2.conf
Diverging Directives#
angie -t fail with an unknown-directive error; a
deprecated one is accepted and logs a warning naming the directive to use
instead.keepalive_min_timeout: Angie omits it, so delete it.Root Directory (Optional)#
/usr/share/nginx/html/.
Copy the contents into the Angie directory:$ sudo rsync -a /usr/share/nginx/html/ /usr/share/angie/html/
# root /usr/share/nginx/html;
root /usr/share/angie/html;
User and Group (Optional)#
angie account. nginx's account keeps working, so
this step is optional; to switch the workers to the Angie account:# user www-data www-data;
user angie angie;
root, so the ownership of /etc/angie/ does not change. What the
workers need is access to the content they serve:$ sudo chown -R angie:angie /usr/share/angie/html/
$ sudo chown -R angie:angie /var/www/html/
Final Check#
$ grep -rn nginx /etc/angie/
fastcgi_params, scgi_params, uwsgi_params) name nginx
harmlessly; what matters is paths that still resolve under /etc/nginx/
or /var/log/nginx/.Testing and Switching#
$ sudo angie -t
Stopping nginx, Starting Angie#
$ sudo systemctl stop nginx && sudo systemctl start angie
$ sudo systemctl enable angie
$ curl -I localhost
HTTP/1.1 200 OK
Server: Angie/1.12.2
...
Disabling nginx#
$ sudo systemctl disable nginx
Certificates#
Certbot#
nginx.conf in the server
root and reloads the server through the nginx binary. Point it at Angie before
the next renewal.$ sudo ln -s /etc/angie/angie.conf /etc/angie/nginx.conf
$ sudo certbot --nginx --nginx-server-root=/etc/angie --nginx-ctl=angie -d example.com -d www.example.com
$ sudo certbot renew --dry-run
Built-in ACME Client#
Where to Go Next#