Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services .ebextensions未执行未上载和创建文件_Amazon Web Services_Ssl_Nginx_Ebextensions - Fatal编程技术网

Amazon web services .ebextensions未执行未上载和创建文件

Amazon web services .ebextensions未执行未上载和创建文件,amazon-web-services,ssl,nginx,ebextensions,Amazon Web Services,Ssl,Nginx,Ebextensions,我正试图遵循在AWS Beanstalk上强制SSL 我相信这是最重要的部分 files: "/tmp/45_nginx_https_rw.sh": owner: root group: root mode: "000644" content: | #! /bin/bash CONFIGURED=`grep -c "return 301 https" /opt/elasticbeanstalk/support/conf/webapp_

我正试图遵循在AWS Beanstalk上强制SSL

我相信这是最重要的部分

files:
  "/tmp/45_nginx_https_rw.sh":
    owner: root
    group: root
    mode: "000644"
    content: |
      #! /bin/bash

      CONFIGURED=`grep -c "return 301 https" /opt/elasticbeanstalk/support/conf/webapp_healthd.conf`

      if [ $CONFIGURED = 0 ]
        then
          sed -i '/listen 80;/a \    if ($http_x_forwarded_proto = "http") { return 301 https://$host$request_uri; }\n' /opt/elasticbeanstalk/support/conf/webapp_healthd.conf
          logger -t nginx_rw "https rewrite rules added"
          exit 0
        else
          logger -t nginx_rw "https rewrite rules already set"
          exit 0
      fi

container_commands:
  00_appdeploy_rewrite_hook:
    command: cp -v /tmp/45_nginx_https_rw.sh /opt/elasticbeanstalk/hooks/appdeploy/enact
  01_configdeploy_rewrite_hook:
    command: cp -v /tmp/45_nginx_https_rw.sh /opt/elasticbeanstalk/hooks/configdeploy/enact
  02_rewrite_hook_perms:
    command: chmod 755 /opt/elasticbeanstalk/hooks/appdeploy/enact/45_nginx_https_rw.sh /opt/elasticbeanstalk/hooks/configdeploy/enact/45_nginx_https_rw.sh
  03_rewrite_hook_ownership:
    command: chown root:users /opt/elasticbeanstalk/hooks/appdeploy/enact/45_nginx_https_rw.sh /opt/elasticbeanstalk/hooks/configdeploy/enact/45_nginx_https_rw.sh
由于某些原因,未上载或创建文件

我还尝试使用sudo命令来处理以00和01开头的容器命令

我还手动ssh到服务器,手动创建文件。然后本地使用aws elasticbeanstalk restart app server--environment name命令重新启动服务器。但这仍然不起作用


任何帮助都将不胜感激。

这可能有效,也可能无效。但在AWS中,一切都是通过跟踪和误差方法解决的。在尝试放入文件之前,我们需要确保目录已经存在。一篇关于这个的博客文章,