【 환경 설정 】 Centos 7 nginx + php + redis 환경 구축

1. nginx install: 현재 시스템 버 전에 대응 하 는 nginx 패키지 다운로드 (package)
# wget  http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
  nginx yum  
# rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm
     nginx
# yum install nginx
  nginx  
systemctl start nginx
  
         /etc/nginx    ,              nginx;      ,      nginx.conf      。
  
            nginx      IP,      ,            。

/etc/nginx/nginx.conf delete the comment #
###########################################
 location ~ \.php$ {
        root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html/$fastcgi_script_name;
        include        fastcgi_params;
    }
###########################################

service nginx restart

2、redis install:
wget http://download.redis.io/releases/redis-3.0.0.tar.gz
tar zxvf redis-3.0.0.tar.gz
cd redis-3.0.0
./configure;make;make install
redis-server /etc/redis.conf

3、php-redis install:
error:the GPG keys listed for the "CentOS-7 - Updates - 163.com" repository are already insta
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
cd /tmp
wget https://github.com/nicolasff/phpredis/zipball/master -O php-redis.zip
unzip php-redis.zip
      :nicolasff-phpredis-21d6614
cd nicolasff-phpredis-21d6614
phpize
./configure
make
make install
    so           
ll /usr/lib/php/modules/redis.so
vi /etc/php.ini 
add the following content.
extension=redis.so
[root@localhost phpredis-phpredis-fc673f5]# ll /usr/lib64/php/modules/redis.so

4、php-fpm install:
so as to parse the php by nginx
yum install php-fpm

5、start php-fpm nginx
vi /etc/php-fpm.conf daemonize = yes
php-fpm -c /etc/php.ini
service nginx restart

6、test nginx and php
http://localhost/test.php

echo phpinfo();
?>

좋은 웹페이지 즐겨찾기