gpt4 book ai didi

apache - 在 AWS ebextensions 中执行命令

转载 作者:行者123 更新时间:2023-12-02 07:34:04 25 4
gpt4 key购买 nike

我在尝试在 aws elasticbeanstalk 中上传实例时收到以下错误:

The configuration file .ebextensions/setup.config in application version t5 contains invalid YAML or JSON. 
YAML exception: while scanning a quoted scalar in "<reader>", line 3, column 18: command:
"aws s3 cp s3:elasticbeanstalk-u ... ^ found unexpected end of stream in "<reader>",
line 5, column 1: ^ , JSON exception: Unexpected character (c) at position 0.. Update the configuration file.

以下是 setup.config 文件中包含的内容:

container_commands:
01_setup_apache:
command: "aws s3 cp s3:elasticbeanstalk-us-west-2-273610000489/enable_mod_rewrite.conf /etc/httpd/co

我正在使用 AWS elastic beanstalk,由于我无法将 httdp conf 文件修改为 AllowOverride All 以便使用重写规则清理我的 URL,建议我使用 ebextensions: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers.html

更新:

enter image description here

我认为运行问题是这样的:

RewriteEngine On

位于 htaccess 中。几乎就像它无法接受打开 rewritenegine 一样。

更新2:

/var/log/httpd/access_log

/var/log/eb-activity.log中:

Command CMD-TailLogs succeeded.
[2015-07-10T10:25:09.784Z] INFO [25589] - [CMD-TailLogs] : Starting activity...
[2015-07-10T10:25:10.206Z] INFO [25589] - [CMD-TailLogs/AddonsBefore] : Starting activity...
[2015-07-10T10:25:10.207Z] INFO [25589] - [CMD-TailLogs/AddonsBefore] : Completed activity.
[2015-07-10T10:25:10.207Z] INFO [25589] - [CMD-TailLogs/TailLogs] : Starting activity...
[2015-07-10T10:25:10.207Z] INFO [25589] - [CMD-TailLogs/TailLogs/TailLogs] : Starting activity...

/var/log/eb-commandprocessor.log

    [2015-07-10T10:37:19.644Z] DEBUG [25873] : Checking if the command processor should execute...
[2015-07-10T10:37:19.645Z] DEBUG [25873] : Checking whether the command is applicable to instance (i-80bbbd77)..
[2015-07-10T10:37:19.645Z] INFO [25873] : Command is applicable to this instance (i-80bbbd77)..
[2015-07-10T10:37:19.645Z] DEBUG [25873] : Checking if the received command stage is valid..
[2015-07-10T10:37:19.645Z] INFO [25873] : No stage_num in command. Valid stage..
[2015-07-10T10:37:19.645Z] INFO [25873] : Command processor should execute command.
[2015-07-10T10:37:19.645Z] DEBUG [25873] : Storing current stage..
[2015-07-10T10:37:19.645Z] DEBUG [25873] : Stage_num does not exist. Not saving null stage. Returning..
[2015-07-10T10:37:19.646Z] INFO [25873] : Executing command: CMD-TailLogs...
[2015-07-10T10:37:19.646Z] DEBUG [25873] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2015-07-10T10:37:19.647Z] DEBUG [25873] : Refreshing metadata..
[2015-07-10T10:37:20.061Z] DEBUG [25873] : Refreshed environment metadata.
[2015-07-10T10:37:20.061Z] DEBUG [25873] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
[2015-07-10T10:37:20.062Z] DEBUG [25873] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
[2015-07-10T10:37:20.064Z] INFO [25873] : Found enabled addons: ["logpublish"].
[2015-07-10T10:37:20.066Z] INFO [25873] : Updating Command definition of addon logpublish.
[2015-07-10T10:37:20.066Z] DEBUG [25873] : Loaded definition of Command CMD-TailLogs.
[2015-07-10T10:37:20.066Z] INFO [25873] : Executing command CMD-TailLogs activities...
[2015-07-10T10:37:20.066Z] DEBUG [25873] : Setting environment variables..
[2015-07-10T10:37:20.066Z] INFO [25873] : Running AddonsBefore for command CMD-TailLogs...
[2015-07-10T10:37:20.067Z] DEBUG [25873] : Running stages of Command CMD-TailLogs from stage 0 to stage 0...
[2015-07-10T10:37:20.067Z] INFO [25873] : Running stage 0 of command CMD-TailLogs...
[2015-07-10T10:37:20.067Z] DEBUG [25873] : Loaded 1 actions for stage 0.
[2015-07-10T10:37:20.067Z] INFO [25873] : Running 1 of 1 actions: TailLogs...

更新3:

enter image description here

最佳答案

在将 .ebextensions 提交到 Elastic Beanstalk 之前,请务必检查它们。我用来检查我的文件的资源 http://www.yamllint.com/

如果您尝试修改 Apache 配置,那么我建议在 ebextensions 中使用"file"。 read more...

我相信您正在努力实现以下目标:

files:          
"/etc/httpd/conf.d/enable_mod_rewrite.conf":
mode: "644"
owner: root
group: root
content: |
AllowOverride All

关于apache - 在 AWS ebextensions 中执行命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31316369/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com