Just wondering what is the difference between
import { getContent } from '@/assets/welcome-content.js'
import Navigation from '@/components/Navigation'
and
import { getContent } from '~/assets/welcome-content.js'
import Navigation from '~/components/Navigation'
Both seems to work
but when I add the lines below in nuxt.config.js
router: {
base: '/siteA/'
},
I have the following error :
Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: "/".
Context :
I have 3 nuxt website that I want to put under the same domain
- mysite.fr/siteA/
- mysite.fr/siteB/
- mysite.fr/siteC/
As for my Nginx conf
server {
...
server_name example.com;
...
location /siteA {
root /var/www/siteA/dist;
...
}
location /siteB {
root /var/www/siteB/dist;
...
}
...
}
2
Answers
Seems like this approach is not good. What I end up doing to have multiple website / webapp under the same domain separated by their path / location is via reverse proxy of nginx.
If you are interested, you'll need to have docker and nginx in your VPS.
docker run -network=bridge -p 127.0.0.1:<hostport>:<containerport>
whereas host is what you'll expose to nginx, and containerport is the port to access your app inside the container.For more doc:
https://nodejs.org/en/docs/guides/nodejs-docker-webapp/
https://tecadmin.net/tutorial/docker/docker-manage-ports/
my nginx command
sudo docker run --name nginx -v /docker/nginx:/etc/nginx --log-opt max-size=10m --log-opt max-file=5 --network=host
so that inside /docker/nginx I have nginx.conf and every changes I rundocker restart nginx
to apply changes.The error you are getting means that you are trying to navigate an url you are already on. It does not have any relations with the prefixes (aliases) you mentioned. They are just shortcuts to the "src" directory to be able to easily import the components you need.