整活 · 29 2 月, 2020 0

完整重装Nginx

一般卸载完Nginx后如果删除了/etc/nginx文件夹,再次重装时会报错:

Restarting nginx: nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)  

正确的重装方法是:首先

apt-get remove --purge nginx nginx-full nginx-common

然后

apt-get install nginx

这样做可避免不完全卸载Nginx后删除nginx.conf导致无法顺利通过APT重新安装的问题。

https://serverfault.com/questions/317191/how-to-install-nginx-and-install-the-configuration-files-too