System Information
- Strapi Version: v3.6.1
- Operating System: Ubuntu
- Database: mySql
- Node Version: v14.17.5
- NPM Version: 6.14.14
- Yarn Version:
Hi, I plan to deploy strapi via docker-compose by using the docker-compose file and server.js shows in below. Found out the url configuration in server.js doesn’t work as expected.
I expected to load the api from http://<host_ip>:1337/shelf/ and load admin panel at http://<host_ip>:1337/shelf/admin.
I failed to open admin panel at http://<host_ip>:1337/shelf/admin , the strapi log shows
strapi_1 | [2021-09-09T16:57:07.551Z] debug GET /shelf/admin (5 ms) 404
Insteand I open http://<host_ip>:1337/admin. Not sure what is going wrong. Thank you.
server.js
module.exports = ({ env }) => ({
host: env('HOST'),
port: env.int('PORT'),
url: env('URL'),
admin: {
url: '/admin',
auth: {
secret: env('JWT_SECRET', '<hide>'),
}
}
})
docker-compose.yaml
version: '3'
services:
strapi:
build: ./shelf-api
environment:
HOST: 0.0.0.0
PORT: 1337
URL: http://0.0.0.0:1337/shelf
DATABASE_TYPE: mysql
DATABASE_CLIENT: mysql
DATABASE_HOST: mysql
DATABASE_PORT: 3306
DATABASE_NAME: shelf
DATABASE_USERNAME: <user_name>
DATABASE_PASSWORD: <password>
DATABASE_SSL: 'false'
NODE_ENV: production
volumes:
- ./app:/srv/app
ports:
- '1337:1337'
depends_on:
- mysql
mysql:
image: mysql
command: mysqld --default-authentication-plugin=mysql_native_password
volumes:
- ./data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: shelf
MYSQL_USER: <user_name>
MYSQL_PASSWORD: <password>