【问题标题】:elastic beanstalk basic http auth for PHP / Symfony用于 PHP / Symfony 的弹性 beanstalk 基本 http 身份验证
【发布时间】:2017-05-31 03:25:45
【问题描述】:

我想为我的 symfony elastic beanstalk PHP 应用程序实现基本的 http auth。我已经找到了this link where it is explained for an other php project,并根据我的 symfony 需求对其进行了一些调整。

files:
  "/etc/httpd/conf.d/allow_override.conf":
    mode: "000644"
    owner: ec2-user
    group: ec2-user
    encoding: plain
    content: |
      <Directory /var/www/html/www/ />
        AllowOverride AuthConfig
      </Directory>

  "/etc/httpd/conf.d/auth.conf":
    mode: "000644"
    owner: ec2-user
    group: ec2-user
    encoding: plain
    content: |
      <Directory /var/www/html/www/ />
        AuthType Basic
        AuthName "Myproject Prototype"
        AuthUserFile /etc/httpd/.htpasswd
        Require valid-user
      </Directory>

  "/etc/httpd/.htpasswd":
    mode: "000644"
    owner: ec2-user
    group: ec2-user
    encoding: plain
    content: |
      admin:lala

问题是:我不确定要在那里设置什么目录。 我试过了:

  • /var/www/html/www/
  • /var/www/html/www
  • /var/www/html/
  • /var/www/html

但这些都不起作用。我得到的只是一些错误 503。

【问题讨论】:

    标签: php symfony amazon-web-services amazon-elastic-beanstalk


    【解决方案1】:

    当您使用 Symfony 时,您的目录将是:/var/www/html/web/

    您还必须将 AllowOverride 设置为 All。您的文件将如下所示:

    files:
      "/etc/httpd/conf.d/allow_override.conf":
        mode: "000644"
        owner: ec2-user
        group: ec2-user
        encoding: plain
        content: |
          <Directory /var/www/html/web/>
            AllowOverride All
          </Directory>
    
      "/etc/httpd/conf.d/auth.conf":
        mode: "000644"
        owner: ec2-user
        group: ec2-user
        encoding: plain
        content: |
          <Directory /var/www/html/web/>
            AuthType Basic
            AuthName "Myproject Prototype"
            AuthUserFile /etc/httpd/.htpasswd
            Require valid-user
          </Directory>
    
      "/etc/httpd/.htpasswd":
        mode: "000644"
        owner: ec2-user
        group: ec2-user
        encoding: plain
        content: |
          admin:$apr1$e2ahR98m$oQ9tE8rqr/l5XPr3cCZYK1
    

    【讨论】:

    • 嘿,感谢您的回复 :) /www 没关系,由于某些原因,文件夹被命名为这样。但是 AllowOverride 信息是新的。非常感谢!与此同时,我通过 vpn-access 解决了我原来的问题 :)
    猜你喜欢
    • 2019-03-01
    • 2012-07-19
    • 2015-05-09
    • 1970-01-01
    • 2016-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-29
    相关资源
    最近更新 更多