Install and configure nginx + postgresql + php + memcached + apc in centos
Last Update:2014-05-30
Source: Internet
Author: User
To install nginx + postgresql + php + memcached + apc in centos, follow these steps: install the software package www.2cto. com01nginx1.0.130203wgethttp: // nginx.org/download/nginx-1.0.13.tar.gz0405425sql9.1.2
To install nginx + postgresql + php + memcached + apc in centos, follow these steps: install the software package: www.2cto.com 01nginx1. 0.1302 03 wget http://nginx.org/download/nginx-1.0.13.tar.gz04 0510000sql9. 1.206 07 wget http://ftp.postgresql.org/pub/source/v9.1.2/postgresql-9.1.2.tar.gz08 09php5. 3.1010 11 wget http://cn2.php.net/get/php-5.3.10.tar.gz/from/ar.php.net/mirror12 13 memcache 1.4.1314 15 wget http://code.google.com/p/memcached/downloads/detail?name=memcached-1.4.13.tar.gz&can=2&q=16 17 memcached php plug-in memcache1.518 19 wget http://pecl.php.net/get/memcache-1.5.tgz20 21apc php plug-in apc3.1.922 23 wget http://pecl.php.net/get/APC-3.1.9.tgz1 . Upgrade system package yum update to disable selinux 2. nginx installation: install pcreyum install pcre * unzip the compilation: 1tar-zxvf nginx-1.0.13.tar.gz2 3cd nginx-1.0.134 5. /configure -- prefix =/usr/local/nginx -- with-http_flv_module -- with-http_stub_status_module -- with-pcre6 www.2cto.com 7 make & make install01yum install jpeg * 02 03yum install libjpeg * 04 05yum install libpng * 06 07yum install iconv * 08 09yum install libiconv * 10 11yum install freetype * 12 13yum install gd * change the configuration file: vi/usr/local/nginx/conf/nginx. conf. remove the following comment: www.2cto.com 01 location ~ \. Php ${02 03 root html; 04 05 fastcgi_pass 127.0.0.1: 9000; 06 07 fastcgi_index index. php; 08 09 fastcgi_param SCRIPT_FILENAME/usr/local/nginx/html $ fastcgi_script_name; 10 11 include fastcgi_params; 12 13} 45 rows add index. after completing these two operations, php starts nginx/usr/local/nginx/sbin/nginx 3. postgresql Installation installation readline yum install readline * unzip the compilation: 1tar-zxvf postgresql-9.1.2.tar.gz2 3cd postgresql-9.1.24 5. /configure -- prefix =/usr/local/postgresql6 www.2cto.com 7 make & make installpostgresql configuration: 01 useradd parts 02 03 mkdir/home/postgre/data04 05 chown-R postgre: postgre/usr/local/postgresql/06 07 chown-R postgre: postgre/home/000008 09su 000010/usr/local/postgresql/bin/initdb -- encoding = utf8-D/home/postgre/data4.php install the required software package www.2cto.com 01yum install jpeg * 02 03yum install libjpeg * 04 05yum install libpng * 06 07yum install iconv * 08 09yum install libiconv * 10 11yum install freetype * 12 13yum install gd * unzip compile 01tar-zxvf php-5.3.10.tar.gz02 03cd php-5.3.1004 05. /configure -- prefix =/usr/local/php -- with-pgsql =/usr/local/postgresql -- with-06 07gd =/usr -- with-jpeg-dir =/usr -- with-png-dir =/usr -- with-zlib -- enable-mb08 09 string -- with-freetype-dir -- with-iconv -- enable-fpm10 11 make & make install copy php. ini www.2cto.com 1cp php. ini-production/usr/local/php/lib/php. ini2 3cd/usr/local/php/etc/4 5mv php-fpm.conf.default php-fpm.confvim php-fpm.conf this configuration can be started by default php-fpm/usr/local/php/sbin/php-fpm 5. memcached install required software package: yum install libevent * unzip the compilation: 1tar-zxvf memcached-1.4.13.tar.gz2 3cd memcached-1.4.134 5. /configure -- prefix =/usr/local/memcached6 7 make & make install6.memcachedphp plugin install the required package yum install autoconf unzip compile www.2cto.com 1tar-zxvf memcache-1.5.tgz2 3cd memcache-1.54 5/usr/ local/php/bin/phpize6 7. /configure -- enable-memcache -- with-php-config =/usr/local/php/bin/php-config -- with-zlib-dir configure memcached and php. ini/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/vim/usr/local/php/lib/php. ini find extension_dir change path to/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/add extension = memcache. so start memcached:/usr/local/memcached/bin/memcached-d m 20-u root-l localhost-p 11211 www.2cto.com start description:-d option is to start a daemon process, -m is the amount of memory allocated to Memcache. the unit is MB. here I am 10 MB.-u is the user who runs Memcache. here I am root, -l is the IP address of the listening server. if there are multiple IP addresses, I have specified the server IP address 192.168.0.200 here,-p is the port for setting the Memcache listening, and I have set 12000 here, it is best to set a port above 1024. The "-c" option is the maximum number of concurrent connections. the default value is 1024. I have set it to 256 based on the load of your server, -P is the pid file for saving Memcache, which is saved in/tmp/memcached. pid 7. apc plug-in installation unzip the compilation install 1tar-zxvf APC-3.1.9.tgz2 3cd APC-3.1.94 5/usr/local/php/bin/phpize6 7. /configure -- enable-apc-mmap -- with-php-config =/usr/local/php/bin/php-config8 9 make & make install configure php. ini www.2cto.com ls/usr/local/php/lib/php/extension/ no-debug-non-zts-20090626/vim/usr/local/php/lib/php. ini in extension = memcache. add extension = apc under so. so and apc. enabled = 1apc. cache_by_default = onapc. shm_segments = 1apc. shm_size = 32apc. ttl = 600apc. user_ttl = 600apc. num_files_hint = 0 apc. write_lock = On check whether the installation is successful/usr/local/php/bin/php-m | after grep apc is installed, reboot uses phpinfo to check whether all files have been loaded 8. automatically start www.2cto.com 1 Echo "/usr/local/nginx/sbin/nginx">/etc/rc. local2 3 echo "/usr/local/php/sbin/php-fpm">/etc/rc. local4 5 echo "/usr/local/memcached/bin/memcached-d m 20-u root-l localhost-p1_11">/etc/rc. local 9. set vim/etc/sysconfig/iptables to enable ports 11211 and 80 10. test script www.2cto.com Phpinfo 1 Memacache 01 Connect ("192.168.10.99", 11211); 06 07 $ mem-> set ('key', 'This is a test! ', 0, 60); 08 09 $ val = $ mem-> get ('key'); 10 11 echo $ val; 12 13?>