使用 Docker 容器时 Nginx 配置错误 运行 来自 dockerhub 的最新版本的 nginx (nginx:alpine)

Nginx config error when using a Docker Container running the latest version of nginx from dockerhub (nginx:alpine)

我有一个 nginx 错误,我想知道为什么会这样,在 debian 10 服务器上这个配置工作得很好但是在我的 alpine nginx docker 容器上它给出了这个错误

/etc/nginx # nginx -t
2020/01/17 18:13:06 [emerg] 189#189: unexpected "s" in /etc/nginx/sites-enabled/phpMyAdmin.conf:33
nginx: [emerg] unexpected "s" in /etc/nginx/sites-enabled/phpMyAdmin.conf:33
nginx: configuration file /etc/nginx/nginx.conf test failed

这是配置文件https://pastebin.com/CwELESRB 这是给出错误的有问题的行

add_header Content-Security-Policy "frame-ancestors 'self'";

非常感谢任何帮助:D

我能看到你的指令的唯一问题是分号的位置,它应该在引号内。

add_header Content-Security-Policy "frame-ancestors 'self';"

这个 page 的底部有一些例子。