How to view a page on localhost?

workspace
meteor

#1

Hi,

I’m following a meteor tutorial. I installed it on a Node workspace. Localhost:3000 doesn’t work and I understand it’s because C9 is on the web.

What is the equivalent to localhost:3000 for my account at: https://ide.c9.io/sdez/udemy_meteor_react

If it matters my meteor project install directory is: images

Edit: I notice someone else had the same issue and a response was: “It’s not working because only ports 8080, 8081, and 8082 are open. run the app on port 8080 and it’ll also be publicly accessible on port 80. the url is right, just not the port.”

Can someone advise on how to open port 3000 or whether it’s even possible?


#2

Update: Both https://udemy-meteor-react-sdez.c9users.io:80/ and /images:80 replacing the end. Neither worked.

Then I tried running: meteor --port 8080 and then testing https://udemy-meteor-react-sdez.c9users.io:8080
and then the same url with /images:8080d

This also did not work


#3

To make a server publicly available on Cloud9, you must serve it with a host of $IP (this environment variable usually resolves to 0.0.0.0), not localhost, and a port of $PORT (resolves to 8080). If you cannot host on that host or IP, use an NGINX reverse proxy to proxy requests to your server running on other ports. An example of a configuration for your case would be this (proxies requests to localhost:3000 and listens on 0.0.0.0:8080:

server {
    listen 8080;
    location / {
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_pass http://localhost:3000;
    }
}