How to deploy whole Wordpress app in Nuxt app?
A bit of background
- NuxtJS (build as static) is a client side app.
- WordPress is a PHP server side app
- A wordpress site usually get served to users by web servers like
apache
ornginx
. - Client side apps served by any web server (including
apache
ornginx
)
So you can't "deploy wordpress in nuxt", but it is simple to get what you want:
- Follow this guide to move the wordpress to a subdirectory
- Upload the nuxt app to the root directory
In case you are using SSR or any other requirements that force you to use Nuxt in server mode, your options are:
- Setup nginx as reverse proxy
- Setup apache as reverse proxy
- Setup a proxy in the node server itself, maybe this project could help
I think there may be a problem with this without the wordpress API, but the question is, do you care about Nuxt.js or maybe just Vue is enough? Remember that in Vue 2 you can use an inline-template, thanks to which you can render elements on the server side. For this you will add the necessary elements from the Vue ecosystem, such as a router and setup you will have similar to Nuxt.js.Example code:
<div is="navbar-dropdown" inline-template> <div v-cloak :class="isOpenDropdown ? 'visible opacity-1 mt-0' : 'invisible opacity-0 mt-10'"> <?php get_search_form(); ?> </div></div>