【发布时间】:2021-05-26 07:09:22
【问题描述】:
我正在将 php symfony 基本欢迎页面项目配置到我正在使用图像的 docker 中
这有我需要用 docker 运行 php 框架的所有包(nginx、php、alpine、docker 标签) 我的 nginx 服务器不工作,当在我的终端(Ubuntu 20.04.2 LTS)中写入 nginx 时,我收到以下错误
nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
目录
project
├── app
├── .git
├── docker-compose.yml
├── Dockerfile
└── README.md
docker-compose.yml
version: '3.8'
services: test-app:
build:
context: .
dockerfile: Dockerfile
container_name: test-app-container
volumes:
- ./app/:/var/www/html
ports:
- "8080:80"
Dockerfile
FROM richarvey/nginx-php-fpm:latest
ENV WEBROOT="/var/www/html/public"
COPY app/* /var/www/html/
WORKDIR /var/www/html
【问题讨论】:
-
低于 1024 的端口需要 root 权限。好像是这样的错误。
-
所以我需要将我的端口从 docker-compose.yml 更改为以下 8080:8080 或任何其他大于 80 的端口号
-
当我更改端口时,它会在终端中引发同样的错误。
-
让我知道我是否从 etc/nginx/default.conf 更改它?
标签: docker symfony nginx docker-compose