I’m trying to deploy our Meteor app (web), and after reading many tutorials, it seems that everybody installs a webserver such as Nginx and use it as a proxy to the app.
In my case, we are having a dedicated server that this meteor app would be the only app/webpage running on the server, why shouldn’t run it directly on port 80, and that be the end of it? What are the benefits of running the Nginx when the only website running is the meteor app?
PS- I have thought of SSL enabled scenarios, do we have to run a webserver such as Nginx in case we wanted to support SSL?
Based on what I know, there are two main reasons not to host directly from Node/Meteor:
- Node needs to run as root to bind port 80, which is bad for a bunch of reasons.
(caveat: there are ways around binding port 80 without root which might be useful here)
- Node is a lot slower at terminating and interpreting SSL connections than nginx and other dedicated web servers/proxies/ssl terminators.
Nginx can also give you the benefit of caching static assets and serving them very efficiently.
That said, you can definitely run Meteor as the webserver, and it will still perform very well. Just get it to start on port 80 and you’re good to go.
So in that sense, we don’t need to create virtual hosting on Nginx, a blank proxy to route all requests to the meteor app should be enough, right?
Yeah pretty much.
Here’s what my conf looks like for SSL termination and proxying to Meteor on port 3000
I also use a second conf for port 80 that just redirects rather than having it in here
Better use --production parameter in this case.
By ‘just get it to run on port 80’ I meant run a production build, using the instructions in the guide haha
You’ll need to run the bundle resulting from a build with node if you want acceptable production performance.
Same applies for running behind nginx
We are using this repo for production-grade deployment on servers using NGinx and load-balancing.
If your app is in production and has users you’ll have to invest to do things right (I would recommend Galaxy if you are making money off your app already, Very High Availability is not an easy task)