1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Heroku Buildpacks PHP Apache 設定まわりまとめ

1
Posted at

Heroku に Buildpacks でデプロイするときの開発環境として、Heroku CLI ではなくコンテナがほしいと思い
Heroku CLI や Buildpacks を解析して Docker イメージを自作したときのメモです。

ちなみに、自作した Docker イメージはこちらです:
futureys/heroku-php-apache2 - Docker Hub

ドキュメントルートが決まるしくみ

Heroku CLI での Apache のドキュメントルートは
Procfile で定義している heroku-php-apache2 コマンドのパラメーターで決まります。

web: $(composer config bin-dir)/heroku-php-apache2 -v web/

このパラメーターは次の Shell Script で環境変数に設定されます。
heroku-buildpack-php/heroku-php-apache2 at fd5ac6063236102038d06f91b938b62b6e60080f · heroku/heroku-buildpack-php

※ $# は引数の数の意味
参考: シェルスクリプト パラメータ キーワードパラメータ

この環境変数は次の Apache conf ファイルでドキュメントルートの設定に使われます。
heroku-buildpack-php/heroku.conf at fd5ac6063236102038d06f91b938b62b6e60080f · heroku/heroku-buildpack-php

heroku-php-apache2 コマンドは
上記の独自の Apache conf ファイルを持っており、
Heroku CLI 実行時にはこの conf ファイルが使われるようです。

heroku-php-apache2 コマンドは
アプリケーションの composer.json の require-dev でインストールします。
heroku/heroku-buildpack-php - Packagist
参考: Customizing Web Server and Runtime Settings for PHP | Heroku Dev Center

Apache のデフォルトの php-fpm の設定ファイルは削除します

Heroku CLI の local コマンドでサービスを起動する場合は
デフォルトの php-fpm の設定ファイルは使わないので削除します。
ansible-role-heroku-cli-amazon-linux/set_up_for_local_command.yml at ed10abc53a1ccf7ffbb869760aac0a5d77f33aa8 · yukihiko-shinoda/ansible-role-heroku-cli-amazon-linux

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?