【发布时间】:2020-12-15 21:48:05
【问题描述】:
beanstalk 文档并不清楚在部署 PHP 应用程序时如何以及什么是自定义 nginx 配置的最佳方式。
我尝试了多种方法,例如包含一个文件 /etc/nginx/conf.d/01-security.conf,如下所示:
files:
/etc/nginx/conf.d/01-security.conf:
mode: “000644”
owner: root
group: root
content: |
add_header X-Frame-Options "SAMEORIGIN" always ;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
always;
add_header X-Cache-Status $upstream_cache_status;
我尝试了其他替代方法,但似乎都没有奏效。我有点困惑,因为 beanstalk 没有给出任何关于如何为 PHP 完成的明确方向?我见过人们使用不同的策略,其中一些早在 2018 年、2017 年......
我可以使用container_commands替换配置,然后重启nginx,但是有什么方法可以添加更多的配置文件或者修改原来的?
【问题讨论】:
标签: php amazon-web-services nginx amazon-elastic-beanstalk