6

Possible Duplicate:
How can I replace missing configuration files after removing a package?

I have installed nginx with apt-get. Than I removed it. I also manually removed /etc/init.d/nginx. After I installed it again with apt-get, it didn't create /etc/init.d/nginx. So service nginx doesn't work anymore. Is is possible to force apt-get to create this file again?

11

Looks like somehow a record remains of that file, which counts as a configuration file (apparently), so a simple apt-get remove doesn't get rid of that record; thus, when reinstalling, apt-get tries to be nice and not overwrite a configuration file (which doesn't exist).

To recreate it, first uninstall using purge to remove even configuration files and records:

apt-get purge nginx nginx-common nginx-full

then reinstall:

apt-get install nginx
  • Please, be careful following this advice AS IT ALSO REMOVES ALL THE CONFIGURATION in /etc/nginx. Be sure to make a copy beforehand. – Denis Kulagin Apr 5 '19 at 7:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.