Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
OrganizationAdvent CalendarQiitadon (β)
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

【俺メモ】CentOS6系にnginx,php5.6,php-fpm をインストール&socketでのnginx連携

More than 5 years have passed since last update.

nginx のインストール

  • nginx用Repositoryの追加
sudo yum localinstall http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
  • インストール
sudo yum install nginx
  • バージョン確認
nginx -v

php,php-fpm のインストールとsocketでのnginx連携

  • phpの最新版をインストールするのに必要なRepositoryの追加
sudo yum localinstall http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo yum localinstall http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
  • phpと周辺モジュールのインストール
sudo yum -y --enablerepo=remi-php56,remi,epel install php php-mbstring
php-xml php-pdo php-mcrypt php-pecl-memcache php-pgsql
  • php-fpmのインストール
sudo yum install yum --enablerepo=remi-php56,remi,epel install php-fpm
  • php-fpmの初期設定
sudo vi /etc/php-fpm.d/www.conf
「user = nginx」へ変更
「group = nginx」へ変更
「listen = /var/run/php-fpm/php-fpm.sock」へ変更
「listen.owner = nginx」へ変更
「listen.group = nginx」へ変更
  • nginx のphp-fpm連携設定
    location ~ \.php$ {
        root           /usr/share/nginx/html;
        fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root/$fastcgi_script_name;
        include        fastcgi_params;


Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away