Reputation: 128
I have two MongoDB instances on two difference ports of server, and the server's router only allows connection to port 80 and 433. Now I want to connect to those instance from my computer. I'm thinking of using Nginx to proxy connection from subdomains, for example https://example.com/mongodb1, https://example.com/mongodb1, to specific ports of server, but it seems to be impossible since MongoDB only receives connection via TCP, while subdomain config is belong to http/https.
Any suggestion?
Upvotes: 0
Views: 612
Reputation: 59456
You can set the port on which MongoDB is running https://docs.mongodb.com/manual/reference/configuration-options/#net.port
net:
port: 80
However, most likely the HTTP server is already listen to this port, so you cannot use it. Apart from that, the firewall may check the packet content and will block it when it detects non-HTTP traffic.
The proper way would be to open the port (default 27017) in the firewall.
Upvotes: 1