Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

4 Answers 4

up vote 9 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]

/var/cache/apt/archives/nginx-common_0.8.54-4_all.deb

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

 
discard

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.