- Remove nginx by using the command: sudo apt-get remove nginx
- Delete /etc/nginx config folder: sudo rm -r /etc/nginx
- Re-install nginx: sudo apt-get install nginx
- Cannot start nginx because of missing conf file! Oops!
After awhile searching on the Internet, I found a solution:
Especially in Ubuntu, I have to look for the packages in the cache folder, and It works:
sudo dpkg -i --force-confmiss /var/cache/apt/archives/nginx*.deb