弹性beanstalk PHP / Symfony的基本http auth

时间:2017-01-16 10:08:10

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

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

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.1.3'
   }
}
  allprojects {
  repositories {
    jcenter()
  }
}
 task clean(type: Delete) {
delete rootProject.buildDir
}

问题是:我不确定在那里设置哪个目录。 我试过了:

  • / var / www / html / www /
  • 的/ var / www / html等/万维网
  • / var / www / html /
  • 的/ var / www / html等

但这一切都没有效果。我得到的只是一些错误503.

1 个答案:

答案 0 :(得分: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