centos7+nginx+php+redis

来源:互联网 发布:淘宝上冲网易宝靠谱吗 编辑:程序博客网 时间:2024/06/05 00:13

1,nginx安装:  
下载对应当前系统版本的nginx包(包)

# 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安装:

wget http://download.redis.io/releases/redis-3.0.0.tar.gztar zxvf redis-3.0.0.tar.gzcd redis-3.0.0./configure;make;make installredis-server /etc/redis.conf

3,php-redis安装:

error:the GPG keys listed for the "CentOS-7 - Updates - 163.com" repository are already instarpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7cd /tmpwget https://github.com/nicolasff/phpredis/zipball/master -O php-redis.zipunzip php-redis.zip解压后目录是:nicolasff-phpredis-21d6614cd nicolasff-phpredis-21d6614phpize./configuremakemake install确认一下so文件已经放置到正确目录ll /usr/lib/php/modules/redis.sovi /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安装:

so as to parse the php by nginxyum install php-fpm

5,启动php-fpm nginx

vi /etc/php-fpm.conf daemonize = yesphp-fpm -c /etc/php.iniservice nginx restart

6,测试nginx和php

http://localhost/test.php<?phpecho phpinfo();?>
原创粉丝点击