php init_mem,mysql+php+mem+openresty

###########mysql###########

1.mysql安装

(1)tar zxf mysql-boost-5.7.17.tar.gz

(2)yum install cmake-2.8.12.2-4.el6.x86_64.rpm  -y

cd mysql-5.7.17/

(3)cmake-DCMAKE_INSTALL_PREFIX=/usr/local/lnmp/mysql-DMYSQL_DATADI=/usr/local/lnmp/mysql/data-DMYSQL_UNIX_ADDR=/usr/local/lnmp/mysql/data/mysql.sock-DWITH_MYISAM_STORAGE_ENGINE=1-DWITH_ARCHIVE_STORAGE_NGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_BOOST=boost/boost_1_59_0/

(4)根据报错依次安装需要的包,没有错误之后执行下一步

(5)myaqlMake && make install

2.Mysql 配置

[root@server1 mysql-5.7.17]# groupadd -g 27 myaql

[root@server1 mysql-5.7.17]# useradd -u 27 -g 27 -s /sbin/nologin -M -d /usr/local/lnmp/mysql/ mysql

[root@server1 mysql-5.7.17]# id mysql

uid=27(mysql) gid=27(myaql) groups=27(myaql)

[root@server1 mysql-5.7.17]# cd /usr/local/lnmp/mysql/

[root@server1 mysql]# chown mysql.mysql . -R

[root@server1 mysql]# cd support-files/

[root@server1 support-files]# ls

magic  my-default.cnf  mysqld_multi.server  mysql-log-rotate  mysql.server

[root@server1 support-files]# ll /etc/my.cnf

-rw-r--r--. 1 root root 251 Aug  9  2013 /etc/my.cnf

[root@server1 support-files]# cp my-default.cnf /etc/my.cnf

cp: overwrite `/etc/my.cnf'? y

[root@server1 support-files]# cp mysql.server /etc/init.d/mysqld

[root@server1 mysql]# mysqld --initialize --user=mysql    ##进行初始化

[root@s erver1 mysql]# chown root.root . -R

[root@server1 mysql]# chown mysql data -R

[root@server1 mysql]# ll

01c577dcc3a8315eee68e6801395a808.png

[root@server1 mysql]# /etc/init.d/mysqld start

Starting MySQL.Logging to '/usr/local/lnmp/mysql/data/server1.err'.

SUCCESS!

[root@server1 data]# mysql_secure_installation   ##密码设置由大小写数字符号组成

3..php安装

Tar zxf php-5.6.20.tar.bz2

Cd php-5.6.20

./configure--prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-openssl --with-snmp --with-gd --with-zlib --with-curl --with-libxml-dir --with-png-dir --with-jpeg-dir --with-freetype-dir --with-gmp --with-gettext --enable-inline-optimization --enable-soap --enable-ftp --enable-sockets --enable-fpm --enable-mbstring --with-fpm-user=nginx --with-fpm-group=nginx --with-mcrypt --with-mhash

随着提示安装所需要的包

yum install libmcrypt-2.5.8-9.el6.x86_64.rpm libmcrypt-devel-2.5.8-9.el6.x86_64.rpm -y

yum install libxml2-devel -y

yum install -y bison

yum install curl-devel freetype-devel gmp-devel net-snmp-devel -y

yum install re2c-0.13.5-1.el6.x86_64.rpm -y

yum provides */png.h

yum install -y libpng-devel-1.2.49-1.el6_2.x86_64

yum provides */jpeglib.h

yum install libjpeg-turbo-devel -y

Make && make install

4.php配置

[root@server1 ~]# cd php-5.6.20

[root@server1 php-5.6.20]# cd sapi/

[root@server1 sapi]# cd fpm/

[root@server1 fpm]# file init.d.php-fpm

init.d.php-fpm: POSIX shell script text executable

[root@server1 fpm]# cp init.d.php-fpm /etc/init.d/php-fpm

[root@server1 fpm]# chmod +x /etc/init.d/php-fpm

[root@server1 fpm]# cd /usr/local/

[root@server1 local]# cd lnmp/php/etc/

[root@server1 etc]# vim php.ini

ae27f8a25e4ea02a9bece60004ffd598.png

[root@server1 etc]# cp php-fpm.conf.default php-fpm.conf

[root@server1 etc]# vim php-fpm.conf

ce0d2d4d125cc762afb9ac00afb45963.png

[root@server1 etc]# /etc/init.d/php-fpm start

Starting php-fpm  done

[root@server1 etc]# vim ~/.bash_profile

651c2291a84942c356038873331414a0.png

[root@server1 etc]# source ~/.bash_profile

[root@server1 etc]# netstat -antlp |  grep :9000

tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      1374/php-fpm

[root@server1 nginx]# ln -s /usr/local/lnmp/nginx/sbin/nginx /sbin/

[root@server1 conf]# vim nginx.conf

5dbe98625dc40fb9be6c26eae76d3cfb.png

b9f9caddfb7dadb7a5543c2045367dde.png

[root@server1 nginx]# nginx

[root@server1 nginx]# netstat -antlp  | grep :80

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name

tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      1418/nginx

[root@server1 html]# vim index.php

a477dc2284f81593ac2d2976283af12b.png

[root@server1 html]# /etc/init.d/iptables stop

测试:

469759d48825ce8102abb96a701bea60.png

5..论坛

[root@server1 ~]# unzip Discuz_X3.2_SC_UTF8.zip

[root@server1 ~]# mv upload/ /usr/local/lnmp/nginx/html/bbs

[root@server1 ~]# cd /usr/local/lnmp/nginx/html/bbs

[root@server1 bbs]# chmod 777 config/ data/ uc_client/ uc_server/ -R

[root@server1 local]# cd /usr/local/lnmp/php/etc/

[root@server1 etc]# vim php.ini

376215a9a88a5aff13c47153f74fcaab.png

637bfc88e7e158c454f3e66f2265eb2d.png

4bda18fe594114f66dbafe0ce14721ea.png

[root@server1 etc]# chmod 755 /usr/local/lnmp/mysql/data/

[root@server1 etc]# /etc/init.d/php-fpm reload

测试:

bfab92bbac5240a7e845da7aa0ecd50c.png

6.Memcache

[root@server1 ~]# tar zxf memcache-2.2.5.tgz

[root@server1 ~]# cd memcache-2.2.5

[root@server1 memcache-2.2.5]# phpize

Configuring for:

PHP Api Version:         20131106

Zend Module Api No:      20131226

Zend Extension Api No:   220131226

[root@server1 memcache-2.2.5]# ./configure

[root@server1 memcache-2.2.5]# make && make install

[root@server1 no-debug-non-zts-20131226]# which php

/usr/local/lnmp/php/bin/php

[root@server1 etc]# cd /usr/local/lnmp/php/etc/

[root@server1 etc]# rpm -e `rpm -qa|grep php`

[root@server1 etc]# vim php.ini

2275e1a58b861931c429bc7b81350702.png

[root@server1 etc]# /etc/init.d/php-fpm reload

Reload service php-fpm  done

[root@server1 etc]# php -m |grep memcache

memcache

[root@server1 ~]# cd memcache-2.2.5

[root@server1 memcache-2.2.5]# yum install -y memcached

[root@server1 memcache-2.2.5]# /etc/init.d/memcached start

Starting memcached:                                        [  OK  ]

[root@server1 memcache-2.2.5]# cp example.php memcache.php  /usr/local/lnmp/nginx/html/

[root@server1 memcache-2.2.5]# cd /usr/local/lnmp/nginx/html/

[root@server1 html]# ls

50x.html  bbs  example.php  index.html  index.php  memcache.php

[root@server1 html]# vim memcache.php

36c4f90b38ca40746c5905a93b1d564a.png

[root@server1 html]# /etc/init.d/memcached reload

Stopping memcached:                                        [  OK  ]

Starting memcached:                                        [  OK  ]

测试:

ee207e27667615797952e1ab510cd80e.png

7.openresty   ##openresty是一个基于nginx的可伸缩web平台,使用lua并编写脚本,然后部署到ngnix web容器中运行,从而能更轻松开发出高性能的web服务

tar zxf openresty-1.11.2.3.tar.gz

cd openresty-1.11.2.3

./configure

Gmake && gmake install

cd /usr/local/openresty/nginx/conf/

vim nginx.conf

6ec74577fd29551fcd9670a8d5cbc21d.png

6d11b809c04717d6770232d0ed383bac.png

4422c4fec88c8c41a100c9c64a84e6a0.png

[root@server1 conf]# netstat -antlp | grep :11211

4fc129e0c219805e02ecc5e8fc442b34.png

nginx -s reload

/etc/init.d/memcached  reload

测试:

[kiosk@foundation1 ~]$ ab -c10 -n  5000http://172.25.254.11/index.php

fb551073f01ae8db28779ecc84234fa5.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值