TL;DR - You probably don't need Nginx and you definitely don't need 
Passenger.

Node is different from Ruby in that it doesn't really need an HTTP proxy to 
sit in front of it (LinkedIn famously removed their front-end proxies a few 
years ago). When you run peerjs, it's starting an http server already. You 
can just hit the port it's listening to. Peerjs probably says what port 
it's listening to when it starts up. You can just use that for dev.

In production, this may vary a bit. If you're running in amazon, then an 
ELB/ALB will sit in front of your service and will direct traffic to this 
service:port. If not, you may want nginx for SSL termination or to split 
traffic on a path, but this is just a straight proxy_pass, not Passenger. 
Here's an excerpt from the nginx docs on setting up a simple proxy.

  server { # simple load balancing
    listen          80;
    server_name     big.server.com;
    access_log      logs/big.server.access.log main;

    location / {
      proxy_pass      http://big_server_com;
    }
  }


HTH,
Mikkel
https://www.oblivious.io/ <https://www.oblivious.io/?r=googlenodejs>

On Sunday, April 15, 2018 at 7:19:55 PM UTC-7, fugee ohu wrote:
>
> My nginx conf has some ruby on rails web servers I'm trying to setup a 
> node server for the first time my node server is located at 
> /home/myusername/node_modules/peer/bin/peerjs where peerjs is a filename 
> The suggested use is to have the server listen on port 9000, so in my nginx 
> conf i've created a server with  passenger_app_type node;    
> passenger_startup_file peerjs; directives but what about the server root is 
> supposed to be a path to my app's public directory It doesn't have a public 
> directory, all it has is that path to the peerjs file so what should I put 
> for root path?
>
> server {
>     listen 9000;
>     server_name peerjs;
>
>     # Tell Nginx and Passenger where your app's 'public' directory is
>     #  root /usr/home/fugee/node_modules/peer;
>
>     # Turn on Passenger
>     passenger_enabled on;
>     # Tell Passenger that your app is a Node.js app
>     passenger_app_type node;
>     passenger_startup_file peerjs;
> }
>
>
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/258e101b-12ff-4f38-8f78-4133c2d9b5d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to