Migrating from nginx to Angie#
If you're switching from nginx to Angie, congratulations! We have a guide for you.
Keep in mind that it's tailored for a basic replacement scenario
that relies on a packaged version of Angie.
If you're working with containers,
virtual machines, custom paths, or
modules,
you'll need additional adjustments. We recommend using the official packages
from our repositories;
see the installation steps for Angie for your distribution.
Don't start the server yet;
instead, check it with the command sudo angie -V: As this shows,
the configuration
is located in Angie usually requires minimal changes to existing nginx configuration. Copy the entire nginx configuration to We assume nginx configuration is stored in Rename the main configuration file as Angie expects: Update paths throughout the Angie configuration,
starting with the main configuration file.
Details depend on how nginx was installed,
but at minimum you need to update the following. Any include paths that still point to The PID file, which is important for Angie process management: Finally,
access log and error log: If the Then recreate the symlinks in List the original virtual host files, for example: Note their actual location;
here it's If you didn't copy them to Finally, recreate each symlink: Find and install
Angie equivalents for 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 dynamic modules are included via Then copy the module configuration files: Finally, change the load_module path in each file: If dynamic modules are included via
Then recreate the symlinks in List the original module configuration files, for example: Note their actual location;
here it's Copy them to Finally, recreate each symlink: If root points to the
Copy the directory and update the While it's sufficient to leave the user directive as is,
you can use Angie accounts for flexibility. Update the Change the owner of all configuration files,
including files in If the Angie configuration has root directives,
change the owner of the directories specified there,
for example: To make sure nothing is missed,
find and fix remaining mentions of After updating Angie configuration,
the next step is to check its syntax
to ensure Angie can work with it,
and then switch over.
Verify that Angie accepts the new configuration: This command parses the configuration
and reports errors that would block Angie startup;
fix any issues and re-run the command. To minimize downtime, start Angie immediately after stopping nginx: If needed, enable the Angie service to start after reboot: Migration complete! That's it; you're awesome. After confirming that Angie is running stably,
you can disable or remove nginx to avoid conflicts. The minimum you can do is disable the service: It's safe to assume you're migrating for a reason.
Why not go further and configure some of the additional features
available in Angie and Angie PRO
that aren't in nginx?Installing Angie#
$ sudo angie -V
Angie version: Angie/1.10.0
nginx version: nginx/1.27.5
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.Updating Angie Configuration#
/etc/angie/
:$ sudo rsync -a --no-links /etc/nginx/ /etc/angie/
/etc/nginx/
;
adjust the steps if you have a different path.$ 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/
directory is used to include virtual hosts,
update it as well:# include /etc/nginx/sites-enabled/*;
include /etc/angie/sites-enabled/*;
/etc/angie/sites-enabled/
to make everything work.$ ls -l /etc/nginx/sites-enabled/
default -> /etc/nginx/sites-available/default
/etc/nginx/sites-available/
./etc/angie/
earlier,
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/
,
update the path:# include /etc/nginx/modules-enabled/*.conf;
include /etc/angie/modules-enabled/*.conf;
/etc/angie/modules-enabled/
to make everything 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/
directory,
you can change the directive to point to Angie.root
value 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/
Testing and Switching#
$ sudo angie -t
Stopping nginx, Starting Angie#
$ sudo systemctl stop nginx && sudo systemctl start angie
$ sudo systemctl enable angie
Disabling nginx#
$ sudo systemctl disable nginx
Configuring Angie Features#