Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm on Ubuntu and I was trying to recover the original settings of /etc/nginx/sites-enabled/default when I accidentally deleted the entire folder. Uninstalling and reinstalling nginx through apt-get won't recreate the original folders.
What can I do to recover them?

share|improve this question
Can't you simply download the package, extract it and find the configuration file you need? :) – tftd Jan 9 '12 at 19:53
up vote 11 down vote accepted

Force the reinstall of the default config files with the --force-confmiss option of dpkg.

Looks like the packaging layout for nginx changed in 11.04. If you're on 10.10 or older:

sudo dpkg --force-confmiss -i /var/cache/apt/archives/nginx_*.deb

Or 11.04 and newer:

sudo dpkg --force-confmiss -i /var/cache/apt/archives/nginx-common_*.deb
share|improve this answer

check for the deb package in your ubuntu system [your version of deb file may be different]


open it using archive manager. Inside the archive check for folder /etc/nginx

This is the default nginx installation cfg folder. You can copy from here to /etc .

share|improve this answer

Don't just apt-get remove it, this will leave configurations behind. apt-get purge it, and any unused dependency. You can check inatallation status by grepping dpkg -l output

share|improve this answer

This should work:

apt-get purge nginx nginx-common nginx-full

and then

apt-get install nginx
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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