docker - 使用 docker 时在 magento2 中使用什么作为基本 url?
问题描述
我有简单的 docker 编排来提供 Magento 文件,这里是我的 docker-compose.yml:
version: "3"
services:
php:
build: docker/php
volumes:
- .:/var/www/html
db:
image: mariadb:10.4
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: magento
volumes:
- ./docker/mysql/databases:/var/lib/mysql
nginx:
image: nginx:alpine
ports:
- 8009:80
links:
- php:phpfpm
volumes:
- ./docker/nginx/conf.d:/etc/nginx/conf.d
- ./docker/nginx/magento.conf:/etc/nginx/magento.conf
- .:/var/www/html
elasticsearch:
image: bitnami/elasticsearch:7
ports:
- 9200:9200
volumes:
- ./docker/elasticsearch/data:/bitnami/elasticsearch/data
如您所见,我想在我的主机端口 8009 上为商店提供服务。
我的问题是,在使用 setup:install 命令并安装我的 Magento 商店时,我应该设置什么 base-url?如果我将其设置为类似 localhost 或 127.0.0.1,当访问 localhost:8009 时,它会将我重定向到 127.0.0.1,这显然是错误的位置
解决方案
当您在 docker 中使用客户端口时,您希望使用的基本 URL 是 URL:端口。
示例 =>
base_url=https://localhost:8009/
推荐阅读
- amazon-web-services - 未找到 aws elasticbeanstalk 负载均衡器
- jenkins - 如何配置 Jenkins 以在堆栈跟踪中显示 groovy 管道脚本名称?
- python - 已安装 Python 包,但来自 __init__ 的内容不可导入
- ios - 在 UIStackView 上添加 UITextField 时应用程序崩溃
- regex - 在电话正则表达式中添加换行符
- javascript - 使用 html 标记更改数组中的元素,然后显示该数组
- ios - 从 Xcode 10 更新到 Xcode 11.3.1 时出现 Xcode 编译器错误
- python - 在 pyqt5 中退出 GUI 时终止正在运行的进程的正确方法是什么?
- postgresql - 禁用 PostgreSQL 查询优化?
- python - 我如何对从 FTP 服务器下载的 tensorflow 模型使用 .predict 方法?