Deleted nginx executable and can't reinstall it

I deleted the nginx executable manually (I think it may have been in /usr/sbin)

Then I uninstalled the nginx package (sudo apt purge nginx). Now when I install nginx again (sudo apt install nginx) the executable is not installed (and the package is only 45.1 kB, which can't be right).

How can I install nginx again?

I also compiled the source code and installed nginx with sudo make install, but when I try to sudo nginx I get the error:

nginx: [emerg] dlopen() "/var/www/html/modules/ngx_http_image_filter_module.so" failed (/var/www/html/modules/ngx_http_image_filter_module.so: cannot open shared object file: No such file or directory) in /etc/nginx/modules-enabled/50-mod-http-image-filter.conf:1

(When I search my directory tree, I find that the ngx_http_image_filter_module.so library is in /usr/lib/nginx/modules, so I don't know why the executable is looking for it in /var/www.)

(Running Ubuntu 20.04.)


Solution 1:

In case you have already taken backup of your system then only restore the executable(/usr/sbin/nginx) and if you don't have backup, You have to just installed the same version of nginx in other machine and do copy the /usr/sbin/nginx to previous machine, and set the permission -rwxr-xr-x of /usr/sbin/nginx.