Next.js: Difference between revisions

From David's Wiki
(Created page with "Next.js allows you to deploy web applications with dynamic server-side and client-side rendering. It also supports static site generation which allows you to build a website and serve it from a file server of your choice. ==Static HTML Export== Reference: https://nextjs.org/docs/advanced-features/static-html-export With a static export, you can serve your website using any file server which can rewrite paths to html files. For example, in Caddy the following config wo...")
 
Line 12: Line 12:
   file_server
   file_server
   try_files {path} {path}.html
   try_files {path} {path}.html
}
}
</pre>
</pre>

Revision as of 10:31, 5 February 2023

Next.js allows you to deploy web applications with dynamic server-side and client-side rendering. It also supports static site generation which allows you to build a website and serve it from a file server of your choice.

Static HTML Export

Reference: https://nextjs.org/docs/advanced-features/static-html-export

With a static export, you can serve your website using any file server which can rewrite paths to html files. For example, in Caddy the following config would suffice:

davidl.me {
  root * /var/www/davidl_me/out
  file_server
  try_files {path} {path}.html
}