"configuration file /etc/nginx/nginx.conf test failed": How do I know why this happened?
sudo nginx -t
should test all files and return errors and warnings locations
This particular commands worked for me.
sudo apt-get remove --purge nginx nginx-full nginx-common
and
sudo apt-get install nginx
credit to this answer on stackexchnage