how to serve my own pages and not the default page on bitnami node server on google compute engine

房东的猫 提交于 2019-12-11 22:58:55

问题


I started a bitnami node server instance on the google compute engine. I uploaded my application files to the vm using filezilla. My application is located at

/home/bitnami/Rockstar22

I have an app.js file in there, that's my node server file. I connect to a mongodb instance (in another instance in the same project) using mongoose. When I ssh into my instance and cd into this directory, I execute the following command, just as I would locally

node app.js

and it displays two console logs (for my confirmation that it's running)

connected to monog...
Listening on port 3000....

now I already bought a domain on goDaddy and I set the A record to the external IP of my instance but it's not serving the pages I want it to. Instead it's serving the default page.

Is there some configuration with apache that I need to perform to make it serve my application pages? After about 10 minutes though, it starts displaying this error


回答1:


Bitnami developer here.

Which IP are you accessing for your Node app? You should be using port 3000 unless you configure it. If you want to access port 80 like a Bitnami app would, you can follow the Bitnami wiki guide to set up a node application with Forever and Apache: https://wiki.bitnami.com/Applications/Bitnami_Custom_Node.js_Application

Also, it seems your application is using the external IP to access MongoDB. I would configure it to use 127.0.0.1 since the Bitnami MongoDB component doesn't allow remote connections by default. If you really want to allow remote connections, you can change the bind_ip from 127.0.0.1 to 0.0.0.0, and then restart MongoDB. You can read more about it here: https://wiki.bitnami.com/Components/mongoDB#How_to_connect_to_the_MongoDB_database_from_a_different_machine.3f



来源:https://stackoverflow.com/questions/32807597/how-to-serve-my-own-pages-and-not-the-default-page-on-bitnami-node-server-on-goo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!