nginx+php+memcache安裝筆記

餘二五發表於2017-11-15

 安裝mysql

./configure –prefix=/opt/test/mysql –localstatedir=/opt/test/var/mysql/var –with-unix-socket-path=/opt/test/mysql/mysql.sock –with-mysqld-user=mysql –with-plugins=archive,partition,myisam,innobase,heap,csv –with-extra-charsets=gbk,gb2312,utf8,ascii –with-charset=utf8 –with-collation=utf8_general_ci –with-big-tables –enable-assembler –enable-profiling –enable-local-infile –enable-thread-safe-client –with-fast-mutexes –with-pthread –with-zlib-dir=bundled –with-readline –without-geometry –without-embedded-server –without-debug –without-ndb-debug –with-client-ldflags=-all-static –with-mysqld-ldflags=-all-static
make && make install
 
安裝nginx
./configure –prefix=/opt/test/nginx –user=www –group=www –with-poll_module –with-http_ssl_module –with-http_gzip_static_module –with-pcre
 
安裝php
./configure –prefix=/opt/test/php  –with-mysql=/opt/test/mysql –with-curl –with-freetype-dir –enable-gd-native-ttf –with-ttf –with-sybase –with-mssql –with-zlib –with-gd –with-jpeg-dir –enable-mbstring=all –enable-mbregex –enable-soap –with-mcrypt –enable-sockets –enable-ftp –enable-zip –with-iconv –with-xsl –with-xmlrpc –with-png-dir –with-openssl –with-db4=/opt/test/db4/
Make && make install
cp php.ini-production   /opt/test/php/lib/php.ini
修改extension_dir
extension_dir = “/opt/test/php/include/php/ext”
 
安裝APC擴充套件
Cd  APC-*
/opt/test/php/bin/phpize
./configure –with-php-config=/opt/test/php/bin/php-config
Make
cp modules/apc.so   /opt/test/php/include/php/ext/
 
在php.ini中新增
extension=apc.so
 
memcache擴充套件
/opt/test/php/bin/phpize;./configure –with-php-config=/opt/test/php/bin/php-config
Make
cp modules/memcache.so   /opt/test/php/include/php/ext/
 
在php.ini中新增
extension=memcache.so
 
安裝ImageMagick
./configure
Make
Make install
 
安裝imagick擴充套件
/opt/test/php/bin/phpize;./configure –with-php-config=/opt/test/php/bin/php-config
Make
cp modules/imagick.so   /opt/test/php/include/php/ext/
 
修改php.ini
extension=imagick.so
 
安裝MagickWandForPHP擴充套件
/opt/test/php/bin/phpize
./configure –with-php-config=/opt/test/php/bin/php-config
Make
cp modules/magickwand.so   /opt/test/php/include/php/ext/
 
修改php.ini
extension=magickwand.so
 
安裝memcached擴充套件
 
安裝memcached
./configure –prefix=/usr/local/memcached
make && sudo make install
 
安裝libmemcached
./configure –with-memcached=/usr/local/memcached/bin/memcached
make && sudo make install
 
安裝memcached擴充套件
/opt/test/php/bin/phpize
./configure –with-php-config=/usr/local/php/bin/php-config
Make
cp modules/memcached.so   /opt/test/php/include/php/ext/
 
編輯php.ini
extension=memcached.so
 
啟動fast-cgi
spawn-fcgi -a 127.0.0.1 -p 10080 -C 250 -u www -f /opt/test/php/bin/php-cgi
 
啟動nginx
/opt/test/nginx/sbin/nginx  -c /opt/test/nginx/conf/nginx.conf
 
Memcached高可用搭建
 
編譯安裝libevent
tar zxvf libevent-1.4.9-stable.tar.gz
cd libevent-1.4.9-stable/
./configure – -prefix=/usr
make && make install
 
編譯安裝Memcached
tar zxvf memcached-1.2.6.tar.gz
cd memcached-1.2.6/
./configure – -with-libevent=/usr
make && make install
 
編譯安裝magent
mkdir magent
cd magent/
wget http://memagent.googlecode.com/files/magent-0.5.tar.gz
tar zxvf magent-0.5.tar.gz
/sbin/ldconfig
sed -i “s#LIBS = -levent#LIBS = -levent -lm#g” Makefile
make
cp magent /usr/bin/magent
 
例項
memcached -m 1 -u root -d -l 127.0.0.1 -p 11211
memcached -m 1 -u root -d -l 127.0.0.1 -p 11212
memcached -m 1 -u root -d -l 127.0.0.1 -p 11213
magent -u root -n 51200 -l 127.0.0.1 -p 12000 -s 127.0.0.1:11211 -s 127.0.0.1:11212 -b 127.0.0.1:11213
本文轉自 waydee 51CTO部落格,原文連結:http://blog.51cto.com/waydee/821036,如需轉載請自行聯絡原作者


相關文章