如果删除/ etc/nginx文件夹(Ubuntu 14.04),如何重新安装nginx?

Cur*_*ity 5 nginx

我正在尝试重新安装nginx,但我有这个

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
Run Code Online (Sandbox Code Playgroud)

如果删除所有nginx文件夹,如何安装和启动nginx?

Ilk*_*lko 21

root身份登录或:

sudo su -
Run Code Online (Sandbox Code Playgroud)

然后卸载nginx:

apt-get purge nginx nginx-common nginx-full  
Run Code Online (Sandbox Code Playgroud)

然后安装它:

apt-get install nginx
Run Code Online (Sandbox Code Playgroud)

另一种方法是运行sudo命令-H:

sudo -H apt-get purge nginx nginx-common nginx-full  
sudo -H apt-get install nginx
Run Code Online (Sandbox Code Playgroud)

  • 你也可以尝试:sudo -H apt-get purge nginx nginx-common nginx-full sudo -H apt-get install nginx (2认同)

小智 9

apt-get --purge remove nginx-*
apt-get install nginx
Run Code Online (Sandbox Code Playgroud)


小智 3

尝试:

sudo aptitude purge nginx && sudo aptitude install nginx
Run Code Online (Sandbox Code Playgroud)

此代码将删除并重新安装 Nginx

  • 我解决了这个问题。有几个包,包括 nginx-core 和 nginx-common。我手动删除它们并且有效。 (3认同)