1

我想为我的symfony弹性beanstalk PHP应用程序实现基本的http auth。我已经发现了this link where it is explained for an other php project并为我的symfony需求调整了一点点。PHP/Symfony弹性beanstalk basic http auth

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等/网络/
  • 在/ var/www/html等/ WWW
  • 在/ var/www/html等/
  • 在/ var/www/html等

但这一切都没有工作。我得到的一些错误503

回答

1

当您使用的Symfony,您的目录将是:在/ var/www/html等/网络/

您还可以在设置AllowOverride设置为所有。你的文件应该是这样的:

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 
+0

哎,感谢您的答复:) /www是还好吧,因为某些原因,文件夹命名为这样。但AllowOverride信息是新的。非常感谢你! 在此期间,我通过vpn访问解决了我的原始问题:) –