Next.js: Things to get ready for production

Created on 4 Feb 2017  路  11Comments  路  Source: vercel/next.js

For beginners, it would be awesome to have doc pointers or examples on how to actually set up a production system. E.g other issues have repeatedly mentioned that compression and caching etc (throttling,...?) should not be done by next.js but on top of it (with cloudflare? Nginx?).

All I know so far is how to make a next.js webapp and deploy it on Now, but I need to make it ready for production:
https://github.com/relatenow/relate

Most helpful comment

Why is this issue closed? I propose it should remain open until more of a solution is drawn out to add explanations such as https, websocket connection between nextjs and azure or aws api's. This could be added in the examples folder or in the wikipedia for ops related tasks.

I would propose there are ops related tasks to actually interfacing nextjs with other cloud api's and that should be covered at least in the wiki.

All 11 comments

I think for beginer, setting up nginx is over complicated (from installing to config).

I suggest using caddy as a web server in front of next.js.

It should be quick and super easy:

  • Download binary for operating system
  • Write a Caddyfile like this
localhost:3000
gzip
log ../access.log
  • It was even packed with Let's Encrypt for SSL out of the box. See here

I think that's fine.
But the point is, there's nothing specific related to Next here.
It's just a typical app which can set behind a proxy or a service like cloudflare.

We are tracking the compression stuff here: https://github.com/zeit/next.js/issues/984

Thanks. I hope I don't need to do anything about SSL as Now provides that? Anyway I'll try my luck by asking on Now's side 馃槈

https://github.com/zeit/now-cli/issues/285

@arunoda Did you try this with cloudflare?
I just tried using it with next.js and get some awkward common.js errors and the app doesn't work any more as soon as i enable cloudflare... nor entirely sure where it comes from, yet.

@sakulstra my site is running next.js with coudflare, no problem at all. Did you enable cloudflare optimization? Like concat js, html, css. Try to disable that

@thangngoc89 intrestingly you're totally right - i had html minification turned on. Thanks a lot!

This is kind of off topic, but just out of curiosity - does someone know why it fails with html minification turned on, but succeeds with minified js and css? This doesn't make sense to me.

@sakulstra I never enable those thing with a SPA because it always leads to weird behaviors. I suggest to disable css and js minification too. Webpack build is optimized.

Have you had any load/performance testing? Trying to scale and load an AWS ELB application and having issues getting bpast 20 requests per second.

Why is this issue closed? I propose it should remain open until more of a solution is drawn out to add explanations such as https, websocket connection between nextjs and azure or aws api's. This could be added in the examples folder or in the wikipedia for ops related tasks.

I would propose there are ops related tasks to actually interfacing nextjs with other cloud api's and that should be covered at least in the wiki.

@jancel did you ever figure out how to solve your issue?

@pruhstal enabling sticky session on AWS solved my issues when scaling, you can do this directly with elastic beanstalk.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rauchg picture rauchg  路  3Comments

irrigator picture irrigator  路  3Comments

swrdfish picture swrdfish  路  3Comments

havefive picture havefive  路  3Comments

flybayer picture flybayer  路  3Comments