Atlast, I have got it working.
The main problems were
-
I was using IIS in which I wasn't able to configure proxy for MQTT.I disabled IIS, downloaded NGINX .
To test if I am able to reach the website, I changed the default listen 80 ( HTTP) to some other port 8080.
On opening 27.0.0.1:8080 ,I was able to see the default page of NGINX, with this I was sure that i am on right path. -
Now the above, was to be checked with public client.On browser, I typed my domainname:8080 , I wasn't able to see.
For this step : I set my in bound ports (Your EC2 Instance >security Groups) in AWS to allow tcp input and output connection on port 8080.
PS: Not sure if outgoing rules are to necessary be set . -
I set windows firewall on by Ec2 instance to allow inbound rules for all connections types to allow incoming data from port 8080.
4)Great!! by these simple 3 steps , I was able to setup my proxy server using NGINX.
- Now for MQTT , went through following tutorial and everything worked.I didn't change any setting on my node-red.
[https://www.nginx.com/blog/nginx-plus-iot-load-balancing-mqtt/#match]
Trick : Before setting up everything on Cloud Instance, just check everything on your local machine.
Then simply copy and paste the settings.js file of node-red , config file of nginx ( with some changes in path).This will save you a lot of lag which might delay your development in cloud
Happy Coding!!
Regards.