Curiosity
Curiosity

Reputation: 671

How to reinstall nginx if I deleted /etc/nginx folder (Ubuntu 14.04)?

I'm trying to reinstall nginx, but I have this

nginx -t

nginx: [alert] could not open error log file: open()    
"/var/log/nginx/error.log" failed (2: No such file or directory)
2015/01/25 16:18:01 [emerg] 1400#0: open() "/etc/nginx/nginx.conf"   
failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed

How to install and start nginx if I removed all the nginx folders?

Upvotes: 20

Views: 63306

Answers (3)

Maximilian König
Maximilian König

Reputation: 80

Try:

sudo aptitude purge nginx && sudo aptitude install nginx

This code will remove and reinstall Nginx

Upvotes: 4

Ilko
Ilko

Reputation: 1418

Login as root or:

sudo su -

Then uninstall nginx:

apt-get purge nginx nginx-common nginx-full  

And then install it:

apt-get install nginx

The other way is to run sudo command with -H:

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

Upvotes: 88

Anonkotone
Anonkotone

Reputation: 251

apt-get --purge remove nginx-*
apt-get install nginx

Upvotes: 25

Related Questions