CentOS7にnginxとphp-fpmをインストールする方法

1.nginxのインストール
# yum install nginx

2.php-fpmのインストール
# yum install –enablerepo=remi,remi-php70 php-fpm

3.php-fpmの設定
#vim /etc/php-fpm.d/www.conf
設定内容
user = nginx
group = nginx

listen = /var/run/php-fpm/php-fpm.sock

listen.owner = nginx
listen.group = nginx

php-fpmの起動
# systemctl start php-fpm
# systemctl enable php-fpm

4.nginxの設定
#vim/etc/nginx/nginx.conf
設定内容
server {
location ~ .php$ {
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;
}
}

nginxの起動
# systemctl start nginx
# systemctl enable nginx

Linux

Posted by arkgame