|
2019-05-17
vi /etc/nginx/conf.d/default.conf
wget http://www.atomicorp.com/installers/atomic.sh #最新的CentOS源。 chmod 755 atomic.sh ./atomic.sh #安装YUM源 yum check-update #更新yum软件包 一、安装nginx yum install nginx service nginx start chkconfig nginx on 二、安装mysql yum install mysql mysql-server mysql-devel service mysqld start chkconfig mysqld on 三、安装php #安装PHP及组件,使PHP支持 MySQL、PHP支持FastCGI模式 yum -y install nginx mysql-server php php-mysql php-gd libjpeg* php-pear php-xml php-mbstring php-mcrypt php-mhash libmcrypt libmcrypt-devel php-imap php-ldap php-bcmath php-xmlrpc php-fpm memcached php-pecl-memcache service mysqld restart service nginx restart service php-fpm start chkconfig php-fpm on 四、安装Memcache 1. 安装Memcache yum install memcached 2.启动Memcache #discuz X3.1 内存优化 memcached -u root -d -m 64 -l 127.0.0.1 -p 11211 #监听ip最好还是设置下,毕竟这玩意儿没任何验证的,用netstat -ln命令查看,发现11211端口已经打开 3.安装PHP的memcache扩展,生成一个memcache.so文件。 yum install php-pecl-memcache service memcached start chkconfig memcached on 五、安装apc yum -y install php-pecl-apc 六、其他测试,memcache Discuz X3.2内存优化 cd /usr/share/nginx/html/ vi memcache.php #建一个 memcache.php 测试页 i < ?php $memcache = new Memcache; $memcache->connect('localhost', 11211) or die ("Could not connect"); $version = $memcache->getVersion(); echo "Server's version: ".$version." \n"; $tmp_object = new stdClass; $tmp_object->str_attr = 'test'; $tmp_object->int_attr = 123; $memcache->set('key', $tmp_object, false, 10) or die ("Failed to save data at the server"); echo "Store data in the cache (data will expire in 10 seconds) \n"; $get_result = $memcache->get('key'); echo "Data from the cache: \n"; var_dump($get_result); ?> esc :wq! chown nginx.nginx memcache.php |
理论部分:Centos 6.3 yum安装 CentOS + Nginx + PHP-FPM + MySQL
编辑:航网科技 来源:深圳航网科技有限公司 本文版权归原作者所有 转载请注明出处
微信扫一扫咨询客服
全国免费服务热线
0755-36300002