Ray, a few clarifications on Grant's email. By setting things up with
NGINX, it now becomes your point of entry for your user's traffic (hence
the name "reverse-proxy").

Cheers!
Gus

On Sun, Jun 21, 2015 at 7:56 AM, Grant MacDonald <minevillian.g...@gmail.com
> wrote:

> Hi Ray.  If the node.js was running on realserver.com:5000.  For the
> Reverse Proxy I first set up a DNS alias for the server (ie. myapp.com to
> realserver.com.)  The reverse proxy in NGINX would look something like
> this:
>

The DNS alias does not necessarily map to the "realserver", but it should
map to the NGINX server (which could be same host).


>
> server {
>   listen 80;
>
>   server_name myapp.com;
>
>   location / {
>       proxy_pass http://localhost:5000/;
>   }
> }
>

It can proxy to "localhost" or any other location, usually an internal
(non-reachable from internet) host.


>
> When the user browses to myapp.com (no port #) it gets redirected to
> realserver.com>localhost:5000.
>

It get's "proxy'd", not redirected. Proxying can be transparent for the
browser, while redirects are literally handled by browsers.


>
>
This is 1 way to eliminate the user to enter a port #.
>
> All the best,
> Grant.
>
> On Saturday, June 20, 2015 at 11:36:33 PM UTC-3, Ray Jender wrote:
>>
>> But how does that alleviate the issue of haveing to browse to IP:Port?
>> I'm not liking that in a production environment.  Or am I missing something?
>>
>> On Saturday, June 20, 2015 at 10:36:28 AM UTC-4, zladuric wrote:
>>>
>>> We set the port to whatever we want, but it's a common security and
>>> usage practice to not use "low ports" (lower then 1024) for app servers. In
>>> fact, in most operating systems, if you run the app server as a non-system
>>> user, you _cannot_ bind to such port.
>>>
>>> The usual practice for Node.js (or, say, Tomcat, or Websphere or RoR or
>>> any other app servers) to be bound to some high port (above 1024) and then
>>> let nginx, apache, IIS or something else serve the port 80, and proxy over
>>> requests to the app server.
>>>
>>> That way on one host you can even run multiple app servers with one web
>>> server.
>>>
>>> Nothing would stop you to run as, say, root on Linux or a Mac, and bind
>>> the Node.js app to port 80, but then  your app has root privileges, and if
>>> your code (or some of the modules you use) is buggy or has security
>>> problems, your app would be a risk to the whole system.
>>>
>>> Zlatko
>>>
>>> On Saturday, June 20, 2015 at 3:43:51 AM UTC+2, Ray Jender wrote:
>>>>
>>>>
>>>> So, for all of the example and demo code I have seen, they always
>>>> include doing "node file.js" and then it echos back "Listening at:
>>>> http://localhost:8080";  or similar.
>>>> Which implies I have to browse to port 8080 to use the app.
>>>>
>>>> My question is how does this work in production?   I have never had to
>>>> browse to a website using a port number?   I'm confused?
>>>> How can I simply browse to a URL and not include a port number?
>>>>
>>>> Thanks,
>>>>
>>>> Ray
>>>>
>>>>
>>>>  --
> 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 nodejs+unsubscr...@googlegroups.com.
> To post to this group, send email to nodejs@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/86cd3a7e-75ac-43de-82f0-09ec0350d192%40googlegroups.com
> <https://groups.google.com/d/msgid/nodejs/86cd3a7e-75ac-43de-82f0-09ec0350d192%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAJkwh4%2Bm9%3DMbhLzbG_LB5S0YTUpEC-pn%3DQGpUqh_kGOO8kTEsg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to