Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 1.42 KB

File metadata and controls

30 lines (21 loc) · 1.42 KB

nginx-nextjs-wordpress

An example setup to host a nextjs app along with wordpress with nginx. Wordpress is available at /content.

wordpress

Site
Admin panel

  • uses the official wordpress docker image
  • wodpress site is available at /content
  • wordpress admin panel can be accessed at - /wp/wp-admin
  • extra wordpress config changes
  • WP_HOME is set to host-ip/content, this ensures that the wordpress site is hosted at /content
  • WP_SITEURL is set to host-ip/wp, this allows us to identify and proxy wordpress client's asset requests. As a sideeffect this also changes the path of the admin panel, instead of /wp-admin it changes to WP_SITEURL/wp-admin

nextjs

Next.js app

  • the starter nextjs app is containerized on top of node:16-alpine and runs at port 3000
  • all paths apart from /content\w* and /wp/* will be proxied to the next server

nginx

  • config
  • uses the official nginx docker image.
  • multiple location directives are used to create proxy rules.
  • Host header is set using proxy_set_header is required, which wordpress uses to handle requests.