NGINX+PHP

一、安装Nginx

yum install -y zlib zlib-devel gcc gcc-c++ openssl openssl-devel pcre pcre-devel
wget http://nginx.org/download/nginx-1.10.0.tar.gz

groupadd -r nginx
useradd -r -g nginx nginx

tar zxf nginx-1.10.0.tar.gz
cd nginx-1.10.0

./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-http_realip_module \
--with-cpu-opt=amd64 \
--http-client-body-temp-path=/var/tmp/nginx/client/ \
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi/ \
--http-scgi-temp-path=/var/tmp/nginx/scgi \
--with-pcre

make && make install

二、yum安装php5.6

安装REMI仓库:安装REMI仓库之前,你首先需要启用EPEL仓库,因为REMI中的一些包依赖于EPEL

1、安装EPEL

yum -y install epel-release
rpm -vih http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-6.noarch.rpm
yum clean all && yum makecache

2、安装REMI仓库

rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

3、安装php5.6

yum --enablerepo=remi install php56 php56-php-fpm php56-php-mysqlnd php56-php-gd  php56-php-xmlrpc php56-php-pecl-redis php56-php-mbstring php56-php-ldap 

4、创建软链接

# which php56
/usr/bin/php56
ln -s /usr/bin/php56 /usr/bin/php

5、文件位置

/opt/remi/php56/root/etc/php.ini 
/opt/remi/php56/root/etc/php-fpm.conf 
/usr/lib/systemd/system/php56-php-fpm.service 

6、启动php-fpm

systemctl start php56-php-fpm

 三、安装memcache扩展

yum install php56-php-devel

cd /opt/remi/php56/root/bin

./pecl install memcache
...
Build process completed successfully
Installing '/opt/remi/php56/root/usr/lib64/php/modules/memcache.so'
install ok: channel://pecl.php.net/memcache-2.2.7
configuration option "php_ini" is not set to php.ini location
You should add "extension=memcache.so" to php.ini

在php.ini末尾添加extension= "/opt/remi/php56/root/usr/lib64/php/modules/memcache.so"
重启php-fpm
posted @ 2016-06-02 15:44  sellsa  阅读(227)  评论(0)    收藏  举报