LoginSignup
1
1

More than 5 years have passed since last update.

Elasticbeantalkでnginx.confの編集を避ける方法

Posted at

ことの発端

ElasticbeanstalkのNode.jsプラットフォームを使ってデプロイする時に.ebextensionsnginx.configの設定を変更する処理を作成していたのですが、思ったようにnginxが起動しませんでした:sob:

デプロイ後のnginx.configを確認したところ、Elasticbeanstalkのスクリプトが設定ファイルを書き換えていたのが原因でnginxが起動していないことがわかったので、その時の回避方法をメモしておきます。

原因

Elasticbeanstalkの起動処理で、/etc/nginx/nginx.confEB_INCLUDEという文字列が含まれていない場合、Elasticbeanstalk用の設定をファイルに追記する処理が発生します。これが原因です。(/opt/elasticbeanstalk/containerfiles/ebnode.py

< てへぺろ

回避方法

事前に/etc/nginx/nginx.confEB_INCLUDEという文字列を追加することで、この追記処理を回避できます。

.ebextentions/00.nginx.config
files:
  "/etc/nginx/nginx.conf" :

    ...

    content: |
      # ebnode.pyの追記を避けるために、適当なところにEB_INCLUDEの文字を追加

    ...

本来ならこんな設定を書きたく無いので、暫定対応としてご活用ください :pray:

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1