Reputation: 38
this is nginx.comfig
events {
}
http {
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://nuxt:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /admin/ { # Strapi Admin Panel
proxy_pass http://strapi-backend:1337/admin/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}
and this is the docker-compose.yml
nginx:
image: nginx:latest
container_name: nginx-proxy
ports:
- "80:80"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
depends_on:
- nuxt
- strapi-backend
strapi-backend:
container_name: strapi-backend
build: ./backend
image: strapi-backend:latest
restart: unless-stopped
environment:
DATABASE_CLIENT: ${DATABASE_CLIENT}
DATABASE_HOST: strapi-backendDB
DATABASE_NAME: ${DATABASE_NAME}
DATABASE_USERNAME: ${DATABASE_USERNAME}
DATABASE_PORT: ${DATABASE_PORT}
JWT_SECRET: ${JWT_SECRET}
ADMIN_JWT_SECRET: ${ADMIN_JWT_SECRET}
DATABASE_PASSWORD: ${DATABASE_PASSWORD}
STRAPI_CORS_ALLOWED_ORIGIN: ${STRAPI_CORS_ALLOWED_ORIGIN}
STRAPI_CORS_ALLOWED_SELF_ORIGIN: ${STRAPI_CORS_ALLOWED_SELF_ORIGIN}
volumes:
- ./backend/config:/opt/app/config
- ./backend/src:/opt/app/src
- ./backend/package.json:/opt/package.json
- ./backend/package-lock.json:/opt/package-lock.json
- ./.env:/opt/app/.env
- ./backend/public/uploads:/opt/app/public/uploads
ports:
- '1337'
depends_on:
- strapi-backendDB
strapi-backendDB:
container_name: strapi-backendDB
platform: linux/amd64
restart: unless-stopped
image: postgres:14.5-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- strapi-backend-data:/var/lib/postgresql/data
ports:
- '5432'
volumes:
nuxt_node_modules:
proxy_node_modules:
emails_node_modules:
payments_node_modules:
strapi-backend-data:
"When NGINX is not in use, I can access the admin panel and use it without issues. However, when NGINX is running, I can still enter the panel, but attempting to modify the data results in the following error:
[Vue Router warn]: No match found for location with path "/content-manager/init"
What could be causing this issue?"
Upvotes: 0
Views: 25
Reputation: 2004
The issue here is:
proxy_pass http://strapi-backend:1337/admin/;
Strapi uses a lot of routes under /
, the main ones are:
/admin
/api
/[pluginName]
Basically all the plugin routes like content-manager
are defined from root /
. You can check exact routes for your application by running yarn strapi routes:list
I've would suggest to change:
events {
}
http {
server {
...
location /strapi/ { # Strapi
proxy_pass http://strapi-backend:1337/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}
Also you need yo have url parameter set on you /config/server.ts
you can use environment
for that.
Upvotes: 0