May be apache is started by default, so when you are trying to run the nginx you are getting this exception, may be try to kill the existing 80 & 443 ports and try once,
sudo fuser -k 443/tcp
sudo fuser -k 80/tcp
Then try,
sudo service nginx restart