502 error after restarting mongo db in remote server using fork command I was trying to upgrade mongo 3.4.20 to 4.0.14 , but it lead to the system crash, so i tried reverting it back to 3.4.20. But after doing db restart using fork , there 502 error. Please help.I tried the following command
sudo mongod --fork --auth --logpath /var/log/mongodb/mongod.log
I could finally get it to work by executing following command  :

sudo mongod --fork --auth --port 27017 --dbpath /var/lib/mongodb --logpath /var/lib/mongodb/mongod.log