Linux centosVMware LNMP架构介绍、MySQL安装、PHP安装、Nginx介绍

一、 LNMP架构介绍

和LAMP不同的是,提供web服务的是Nginx

并且php是作为一个独立服务存在的,这个服务叫做php-fpm

Nginx直接处理静态请求,动态请求会转发给php-fpm

                                                                                                           

二、MySQL安装

 进入

cd /usr/local/src

tar zxvf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz

mv mysql-5.6.36-linux-glibc2.5-x86_64 /usr/local/mysql

cd /usr/local/mysql

useradd mysql

mkdir /data/

./scripts/mysql_install_db --user=mysql --datadir=/data/mysql

cp support-files/my-default.cnf /etc/my.cnf

cp support-files/mysql.server /etc/init.d/mysqld

vi /etc/init.d/mysqld

定义basedir和datadir

/etc/init.d/mysqld start

三、PHP安装

和LAMP安装PHP方法有差别,需要开启php-fpm服务

cd /usr/local/src/

wget http://cn2.php.net/distributions/php-5.6.30.tar.gz

tar zxf php-5.6.30.tar.gz

cd php-5.6.30

先之前编译过的文件删除

./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --with-pear --with-curl --with-openssl

 

make && make install

php-fpm比php多了两个文件

php-fpm用来启动

log存放日志

cp php.ini-production /usr/local/php-fpm/etc/php.ini

进入

cd /usr/local/php-fpm/etc/

vim /usr/local/php/etc/php-fpm.conf//写入如下内容(参考https://coding.net/u/aminglinux/p/aminglinux-book/git/blob/master/D15Z/php-fpm.conf)

或者book.aminglinux.com

 进入cd /usr/local/src

[root@davery etc]# cd /usr/local/src

[root@davery src]# cd php-5.6.30

[root@davery php-5.6.30]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

chmod 755 /etc/init.d/php-fpm

useradd -s /sbin/nologin php-fpm

chkconfig --add php-fpm

chkconfig php-fpm on

service php-fpm start

/usr/local/php-fpm/sbin/php-fpm -t

ps aux |grep php-fpm

 

四、Nginx介绍

Nginx官网 nginx.org,最新版1.13,最新稳定版1.12

Nginx应用场景:web服务、反向代理、负载均衡 Nginx著名分支,淘宝基于Nginx开发的Tengine,使用上和Nginx一致,服务名,配置文件名都一样,和Nginx的最大区别在于Tenging增加了一些定制化模块,在安全限速方面表现突出,另外它支持对js,css合并

Nginx核心+lua相关的组件和模块组成了一个支持lua的高性能web容器openresty,参考http://jinnianshilongnian.iteye.com/blog/2280928

猜你喜欢

转载自www.cnblogs.com/davery/p/8955046.html
今日推荐