问题
Currently I'm running a Django based website. I want to replace my "/admin/" area with a Vue/Nuxt build version but keep the rest of my website for now.
To serve my files I use Apache2 with mod_rewrite enabled. My Nuxt server is running on localhost:3000.
In my .htaccess I wrote this line to proxy /admin/ to the Nuxt Server
RewriteRule ^admin/(.*) http://localhost:3000/$1 [P]
If I access www.example.com/admin/ I see the output of my Nuxt project. But all resources are not loaded because the paths are wrong.
Instead of www.example.com/admin/.nuxt/... Nuxt is "looking" to www.example.com/.nuxt/
How can I change this?
回答1:
I finally solved the problem on my own:
Solution
nuxt.config.js
router: {
base: "/myapp/"
},
.htaccess
RewriteRule ^myapp/(.*) http://localhost:3000/myapp/$1 [P]
RewriteRule ^_nuxt/(.*) http://localhost:3000/_nuxt/$1 [P]
来源:https://stackoverflow.com/questions/56806714/how-to-deploy-nuxt-ssr-with-mod-rewrite-in-a-sub-folder