can you please invest some more time in writing up your question. This question is pretty unclear. I cannot extract the concrete problem here.
Is your problem, that you cannot connect to Elasticsearch under
localhost:9200? If so, have you checked that the elasticsearch service is running using systemd or sysvinit? Is it even listening on that interface?
And how does nginx or apache come into play here from your point of view? You can run on the same server (another question is if you should).
Looking forward to help.