LNMP架构---nginx和php

php:

一.官网下载php-7.4.6.tar.bz2

阿里云下载安装包oniguruma-6.8.2-1.el7.x86_64.rpm     oniguruma-devel-6.8.2-1.el7.x86_64.rpm

yum install -y bzip2
tar jxf php-7.4.6.tar.bz2
cd php-7.4.6
yum install -y systemd-devel
yum install -y libxml2-devel
yum install -y sqlite-devel
yum install -y libcurl-devel
yum install -y libpng-devel
yum install -y oniguruma-6.8.2-1.el7.x86_64.rpm oniguruma-devel-6.8.2-1.el7.x86_64.rpm
./configure --prefix=/usr/local/lnmp/php --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx  --with-curl --with-iconv --with-mhash --with-zlib --with-openssl --enable-mysqlnd --with-mysqli --with-pdo-mysql --disable-debug --enable-sockets --enable-soap --enable-inline-optimization --enable-xml --enable-ftp --enable-gd --enable-exif --enable-mbstring  --enable-bcmath --with-fpm-systemd
 make 
 make install

二.将nginx和php结合

vim /usr/local/lnmp/nginx/conf/nginx.conf

在server字段下
location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            include        fastcgi.conf;
        }
vim  /usr/local/lnmp/nginx/html/index.php

<?php
phpinfo()
?>

 

 测试:

cd /root/php-7.4.6/
cp php.ini-production /usr/local/lnmp/php/lib/php.ini
cd /root/php-7.4.6/sapi/fpm/
cp init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/etc/init.d/php-fpm
cd /usr/local/lnmp/php/etc/
cp php-fpm.conf.default php-fpm.conf
cd /usr/local/lnmp/php/etc/php-fpm.d
cp www.conf.default www.conf

/etc/init.d/php-fpm   start
nginx -s reload

三.高速缓存系统

官网下载memcache 4.0.5.2 tgz

yum install -y autoconf

tar zxf memcache 4.0.5.2 tgz

cd  memcache 4.0.5.2
/usr/local/lnmp/php/bin/phpize
./congigure
make
make install 

vi /usr/local/lnmp/php/lib/php.ini

添加一行
extension=memcache.so

/etc/init.d/php-fpm reload  加载php

测试:

cd  /memcache-4.0.5.2

/usr/local/lnmp/php/bin/php -m | grep memcache
过滤是否有memcache这个资源

四.做监控页面memecache.php

yum install -y memcached
systemctl start memcached
cd memcache-4.0.5.2
cp memcache.php example.php /usr/local/lnmp/nginx/html/
cd /usr/local/lnmp/nginx/html/
vim memache.php

$MEMCACHE_SERVERS[] = '127.0.0.1:11211'; // add more as an array
#$MEMCACHE_SERVERS[] = 'mymemcache-server2:11211'; // add more as an array

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值