centos 部署php+nginx+memadmin + memcached

nginx

http://nginx.org/download/nginx-1.7.3.tar.gz

php

http://cn2.php.net/distributions/php-5.5.14.tar.gz

php.memcache插件

http://pecl.php.net/get/memcache-3.0.8.tgz

memadmin

http://www.junopen.com/memadmin/memadmin-1.0.12.tar.gz



install nginx

tar -zxf nginx-1.7.3

cd nginx-1.7.3

./configure --prefix=/opt/nginx

make

make install


install php

tar -zxf php-5.5.14

cd php-5.5.14

./configure --prefix=/opt/php --enable-fastcgi --enable-zend-multibyte --enable-zip --enable-discard-path --enable-force-cgi-redirect --with-libxml-dir --with-curl --with-openssl=/opt/openssl-1.0.1h  --with-zlib --enable-mbstring --with-gd --with-mcrypt --enable-exif --enable-fpm --enable-force-cgi-redirect --enable-pdo --with-ttf --with-iconv --enable-xml --with-gd --with-jpeg-dir=/usr/local/  --with-png-dir=/usr/local --with-freetype-dir=/usr/include/freetype2/  

如果没有以下

openssl-1.0.1h 指定安装到/opt/openssl-1.0.1h目录

http://www.openssl.org/source/openssl-1.0.1h.tar.gz

freetype2

http://download.savannah.gnu.org/releases/freetype/freetype-doc-2.5.3.tar.gz

自己下载安装


memadmin解压到目录/var/www/html/下

tar -zxf memadmin-1.0.12.tar.gz 

mv memadmin-1.0.12 /var/www/html


php.memcache install

tar -zxf memcache-3.0.8.tgz

cd memcache-3.0.8.tgz

/opt/php/bin/phpize 

./configure --with-php-config=/opt/php/bin/php-config --enable-memcache --with-zilib-dir


配置php.ini文件(不知道memcache.so路径,命令:find -name memcache.so)

如果/opt/php/etc/php.ini没有

cp ~/php-5.5.14/php.ini-devlopment /opt/php/etc


vim /opt/php/etc/php.ini

extension_dir=/opt/php/lib/php/extensions/no-debug-non-zts-20121212/memcache.so

extension=memcache.so

include_path = ".:/opt/php/lib:/opt/php/etc"


配置php-fpm.conf文件

pid = run/php-fpm.pid

error_log = log/php-fpm.log

log_level = notice

user = memadmin(自定义用户名,不能用root账号)

group = memadmin(自定义用户名,不能用root账号)

listen = 127.0.0.1:8999(默认为9000, 确定没人占用)

env[HOSTNAME] = $HOSTNAME

env[PATH] = /usr/local/bin:/usr/bin:/bin

env[TMP] = /tmp

env[TMPDIR] = /tmp

env[TEMP] = /tmp


启动php-fpm

/opt/php/sbin/php-fpm

关闭php-fpm

ps -aux|grep php

kill -9 23455  


查看php-memcache是否安装正常

/opt/php/bin/php -m


配置/opt/nginx/conf

vim /opt/nginx/conf/nginx.conf

在第一条加入

user memadmin;(与php-fpm.conf里的user保持一致)

location ~ \.php$ {

            root           /var/www/html/;

            fastcgi_pass   127.0.0.1:8999;

            fastcgi_index  index.php; 

            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;      # /scripts$fastcgi_script_name; 

            include        fastcgi_params;

        }  

启动

 /opt/nginx/sbin/nginx

关闭

/opt/nginx/sbin/nginx -s stop


你可能感兴趣的:(centos 部署php+nginx+memadmin + memcached)