AWS Elastic Beanstalk - 如何在同一个 ec2 实例中 运行 php 和 nodejs

AWS Elastic Beanstalk - how to run php and nodejs in same ec2 instance

我正在使用 Elastic Beanstalk 部署根应用程序 (node.js),并且还想 运行 php node.js 应用程序需要调用的代码相同的 ec2 实例。

当我连接到实例时,它显示:

This EC2 instance is managed by AWS Elastic Beanstalk. Changes made via SSH WILL BE LOST if the instance is replaced by auto-scaling. [...]

这意味着当我在 /var/www/ 文件夹(通过 ssh 连接)中添加 php 个源时,如果实例发生变化,它将被删除。

我怎么能在同一个实例中 运行 node.js 和 php?

您可以探索基于 ECS 的多容器选项,以便在每个 beantalk 环境中 运行 多个容器。

文档:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_ecs.html

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_v2config.html

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_ecstutorial.html

您希望两个应用在同一个实例上 运行 有什么特别的原因吗?

可能是这样的:

**

create an ".ebextensions/nodeinstall.config" file

**

commands:
    node_install:
    cwd: /tmp

    command: 'yum install -y nodejs --enablerepo=epel'

我 运行 前一段时间遇到过类似的情况,这对我有用。

来源: http://qpleple.com