我有一個Amazon EC2 Ubuntu實例,其中包含來自GitHub project的MongoDB,Node.JS和分析服務器示例。如何將Android應用程序連接到自己託管的Parse.com服務器?
我已將我的Parse.com遷移到實例上的MongoDB。它的地址是mongodb://usr:****@xxx.xxx.xxx.xxx:27017/euro
。
我已經在GitHub上安裝了分析服務器示例/var/www/parse
。
當我運行服務器,我得到這個消息:
$ cd /var/www/parse
$ npm run start
> [email protected] start /var/www/parse
> node index.js
DATABASE_URI not specified, falling back to localhost.
parse-server-example running on port 1337.
Parse LiveQuery Server starts running.
我的問題是什麼指向localhost
?公共DNS?公共IP?
如何在Android應用程序中使用此代碼連接到服務器?
Parse.initialize(new Parse.Configuration.Builder(myContext)
.applicationId("YOUR_APP_ID")
.server("http://YOUR_PARSE_SERVER:1337/parse")
.build()
);
當我試圖用這個地址http://ec2-xxx-xxx-xxx-xxx.compute-x.amazonaws.com:1337/parse
(公共DNS)我得到一個消息說,連接已經停止了通過瀏覽器打開它。
當我試圖通過瀏覽器使用此地址http://xxx.xxx.xxx.xxx:1337/parse
(公共IP)打開它時,我收到一條消息,指出連接已停止。
打開安全組中的端口? –
是的,我確實打開了端口 –