$shibayu36->blog;

クラスター株式会社のソフトウェアエンジニアです。エンジニアリングや読書などについて書いています。

debianのapache2の実行ユーザを変更する

 apacheの実行ユーザを変更しようと思っていろいろ見ていたので、メモしておきます。debianに入っているapache2は/etc/apache2/envvarに変数としてユーザやグループが定義されています。

こんな感じ

# envvars - default environment variables for apache2ctl

# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=apache
export APACHE_RUN_GROUP=apache
export APACHE_PID_FILE=/var/run/apache2.pid

このAPACHE_RUN_USERとかAPACHE_RUN_GROUPとかを変えた後、restartすれば実行ユーザが変わります。