How to migrate from nginx to Angie#
If you're switching from nginx to Angie, congratulations! We have a guide for you.
Keep in mind, though, that it's tailored for a basic swap-out scenario
that relies on a packaged version of Angie.
If you're dealing with containers,
virtual machines, custom paths, or modules,
you'll need to tweak things accordingly. We recommend using the official packages
from our repos;
see the instructions for your distribution to install Angie,
but stop short of actually starting it.
Instead, run sudo angie -V to make sure everything's in order: As this output suggests,
the configuration
is located under Angie usually requires minimal changes to an existing nginx configuration. Copy the entire nginx configuration to We assume that nginx stores its configuration under Rename the main configuration file as Angie expects it to be: Update the paths in the entire Angie configuration,
starting with the main configuration file.
The details vary depending on how nginx was installed,
but at least you need to update the following parts. Any include paths that still point under The PID file, which is crucial for Angie PROcess management: Lastly, access log and error log: If a directory such as Next, recreate the symlinks under List the original virtual host files, for example: Note their actual location;
here, it's If you didn't copy them under Finally, recreate each symlink: Find and install Angie's counterparts
to all dynamic modules referenced in nginx configuration, for example: This means you need to install the There are two popular ways to include dynamic module configuration: If the dynamic modules are included via Next, copy the module configuration files: Lastly, amend the load_module path in each file: If the Next, recreate the symlinks under List the original module configuration files, for example: Note their actual location;
here, it's Copy them under Finally, recreate each symlink: If the root directive references a directory
such as Copy the directory and update the While it's fine to leave the user directive as is,
you can use separate accounts with Angie for extra flexibility. Update the Next, change the owner of all configuration files,
including the ones under If Angie configuration defines the root directive,
change the owner of the respective directories too,
for example: To make sure you didn't miss anything,
find and fix the remaining occurrences of Now that you've updated Angie configuration,
the next step is to verify its syntax to
make sure Angie can actually work with it,
and then perform the switchover.
Check that Angie can run the updated configuration: The command parses the configuration
and reports issues that block Angie's start;
fix any problems and re-run it. To minimize downtime, start Angie immediately after stopping nginx: Optionally, enable the Angie service to start it after reboot: The migration is done! That's it. You're amazing. Last, when you're sure that Angie is running smoothly,
you'll need to disable or uninstall nginx to avoid conflicts. The least you can do is disable the service: It's safe to assume that you're migrating for a reason, so why not go a step
further and configure some of the additional features that Angie and Angie PRO offer on top of nginx?Install Angie#
$ sudo angie -V
Angie version: Angie/1.8.2
nginx version: nginx/1.27.3
built by gcc 11.4.0
configure arguments: --prefix=/etc/angie --conf-path=/etc/angie/angie.conf ...
/etc/angie/
when Angie is installed from a package.Update Angie configuration#
/etc/angie/
:$ sudo rsync -a --no-links /etc/nginx/ /etc/angie/
/etc/nginx/
;
adjust the steps if your path is different.$ 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/*;
include /etc/angie/modules-enabled/*;
# include /etc/nginx/mime.types;
include /etc/angie/mime.types;
# 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/
is used to include virtual hosts, update it:# include /etc/nginx/sites-enabled/*;
include /etc/angie/sites-enabled/*;
/etc/angie/sites-enabled/
to make it work.$ ls -l /etc/nginx/sites-enabled/
default -> /etc/nginx/sites-available/default
/etc/nginx/sites-available/
./etc/angie/
previously,
copy them now:$ sudo rsync -a /etc/nginx/sites-available/ /etc/angie/sites-available/
$ 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-geoip2
package,
and so on./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/
# load_module "/usr/lib64/nginx/modules/ngx_http_geoip2_module.so";
load_module "/usr/lib64/angie/modules/ngx_http_geoip2_module.so";
/etc/nginx/modules-enabled/
directory
is used to include dynamic modules, update the path:# include /etc/nginx/modules-enabled/*.conf;
include /etc/angie/modules-enabled/*.conf;
/etc/angie/modules-enabled/
to make it work.$ ls -l /etc/nginx/modules-enabled/
mod-http-geoip2.conf -> /usr/share/nginx/modules-available/mod-http-geoip2.conf
/usr/share/nginx/modules-available/
./usr/share/angie/
:$ 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
Root directory (optional)#
/usr/share/nginx/html/
,
you can change it to point to Angie.root
setting in Angie configuration:$ 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)#
user
settings in Angie configuration:# user www-data www-data;
user angie angie;
/usr/share/angie/
,
for example:$ sudo chown -R angie:angie /etc/angie/
$ sudo chown -R angie:angie /usr/share/angie/
$ sudo chown -R angie:angie /var/www/html/
Wrapping up#
nginx
in Angie configuration:$ grep -rn --include='*.conf' 'nginx' /etc/angie/
Test and switch#
$ sudo angie -t
Stop nginx, start Angie#
$ sudo systemctl stop nginx && sudo systemctl start angie
$ sudo systemctl enable angie
Disable nginx#
$ sudo systemctl disable nginx
Configure Angie extras#