LoginSignup
4

More than 5 years have passed since last update.

PHP の実行ユーザーを変えたかった @nginx + php-fpm

Last updated at Posted at 2016-08-10

Ubuntu & nginx & php (php-fpm) の構成で Web サーバーの実行ユーザーとPHPの実行ユーザーを切り分けたいと思って探した所、次の記事を発見
http://qiita.com/kijtra/items/022d3cde07046e396486
内容的に「nginx と php-fpm の実行ユーザーは切り分ける事ができそう!」という事は分かったけど、「この構成、慣れてないからもしかしたら不具合あるかも」とあったので、ちょっと他にも記事がないかを探したらクラウドサービスを提供している Digital Ocean の記事を発見
https://www.digitalocean.com/community/tutorials/how-to-host-multiple-websites-securely-with-nginx-and-php-fpm-on-ubuntu-14-04

一つ一つの設定に関して丁寧に解説してあって、上のQiitaの記事で書かれてた疑問もここで解消できた

たぶん Qiita の記事の方で listen.mode=0666 にしないと動かない部分は、Digital Ocean の記事にある

listen.owner and listen.group define the ownership of the listener, i.e. the socket of the new php-fpm pool. Nginx must be able to read this socket. That's why the socket is created with the user and group under which nginx runs - www-data.

と繋がってると思う。

リンク貼ってるだけになっちゃったけど、備忘録として。

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
4