nginx: unrecognized service after upgrading Nginx on Ubuntu 18.04

Solution 1:

The old service call is there for 'legacy' programs, but nginx is a SystemD unit, and not a legacy SysVInit/Upstart service.

service nginx configtest is (generally considered) 'deprecated' in favor of straight sudo nginx -t commands to test the configuration nowadays, and you should always operate with sudo nginx -t as your go-to for configuration testing. Rely only on service / systemctl for stopping, starting, and reloading the service. Do not rely on it for the 'configtest' parameters anymore.

(In the nginx IRC chat on Freenode now LiberaChat, we always pushed for people to use sudo nginx -t for their config tests, and sudo nginx -T to dump their configurations in a full readable form for debugging, so this is the 'standard' I go by since the nginx forums also use this notation more than the service calls.)