简体   繁体   English

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

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

I have a nginx error and i'm wondering why this is happening, on debian 10 server this config works perfectly but on my alpine nginx docker container it gives this error我有一个 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

This is the config file https://pastebin.com/CwELESRB This is the line in question that is giving the error这是配置文件https://pastebin.com/CwELESRB这是出现错误的行

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

Any help is extremely appreciated :D非常感谢任何帮助:D

The only problem I can see with your directive is the placement of semi-colon, it should be within the quotes.我在您的指令中看到的唯一问题是分号的位置,它应该在引号内。

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

There are some examples at the bottom of this page .本页底部有一些示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM