centos 部署php+nginx+memadmin + memcached

來源:互聯網
上載者:User

標籤:http   os   檔案   io   for   re   c   html   

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


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.