first you have to stop apache2 using this command (sudo systemctl stop apache2) then start nginx command (sudo systemctl start nginx)