我正在使用AWS弹性beanstalk,因为我无法将httdp conf
文件修改为AllowOverride All
我被建议使用ebextensions
:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers.html 因此,我创建了一个.ebextensions文件夹,其中包含一个setup.config文件,其中包含以下命令:
container_commands:
01_setup_apache:
command: "cp .ebextensions/enable_mod_rewrite.conf /etc/httpd/conf.d/enable_mod_rewrite.conf"
我甚至不确定这是否是启用mod重写的正确命令,但在尝试上传实例时出现以下错误:
[Instance: i-80bbbd77] Command failed on instance. Return code: 1 Output: cp: cannot stat '.ebextensions/enable_mod_rewrite.conf': No such file or directory. container_command 01_setup_apache in .ebextensions/setup.config failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
答案 0 :(得分:1)
您无法从“.ebextensions / enable_mod_rewrite.conf”进行复制,因为该相对路径在init脚本中无效。使用绝对路径可能有效,但我建议你从S3取代:
container_commands:
01_setup_apache:
command: "aws s3 cp s3://[my-ebextensions-bucket]/enable_mod_rewrite.conf /etc/httpd/conf.d/enable_mod_rewrite.conf"
但是,如果您需要对实例进行复杂的更改,则可能更适合运行docker容器:http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker.html