150

By mistake I have removed /etc/nginx directory in my ubuntu 11.10 PC. How can I restore the ngnix directory in /etc/nginx ?

I did these commands:

  1. sudo su
  2. rm -rf /etc/nginx

I want to get again /etc/nginx directory. how?

I tried this to re-install nginx:

  1. sudo apt-get update
  2. sudo apt-get upgrade
  3. sudo apt-get install nginx

then it gives following

Reading package lists... Done

Building dependency tree   

Reading state information... Done
E: Unable to locate package nginx

How can i get full nginx software on ubuntu 11.10?

andrewsi
  • 10,807
  • 132
  • 35
  • 51
Gowri Naidu R
  • 1,964
  • 2
  • 13
  • 15
  • I had these error `ln: failed to create symbolic link ‘/etc/nginx/modules-enabled/50-mod-http-auth-pam.conf’: and `dpkg: error processing package libnginx-mod-http-auth-pam (--configure):` No such file or directory` the below answer was useful. Thanks. – jmunsch Nov 15 '16 at 20:48

1 Answers1

417

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

sudo apt-get purge nginx nginx-common nginx-full

then reinstall:

sudo apt-get install nginx

If above doesn't work for you, you can also try using --force-confmiss option of dpkg.

sudo dpkg --force-confmiss -i /var/cache/apt/archives/nginx-common_*.deb 
Evan Kroske
  • 4,506
  • 12
  • 40
  • 59
Aravind.HU
  • 9,194
  • 5
  • 38
  • 50