标签:12.1lnmp架构介绍12.2 mysql安装12.3/12.4 php安装12.5 nginx介绍
12.1 LNMP架构介绍
12.2 MySQL安装
12.3/12.4 PHP安装
12.5 Nginx介绍
扩展
Nginx为什么比Apache Httpd高效:原理篇 http://www.toxingwang.com/linux-unix/linux-basic/1712.html
apache和nginx工作原理比较 http://www.server110.com/nginx/201402/6543.html
mod_php 和 mod_fastcgi以及php-fpm的比较 http://dwz.cn/1lwMSd
概念了解:CGI,FastCGI,PHP-CGI与PHP-FPMhttp://www.nowamagic.net/librarys/veda/detail/1319/ https://www.awaimai.com/371.html
Linux+Nginx+MySQL+PHP LNMP
nginx 和Apache 在架构里面担任的角色是类似的 在LAMP里,PHP和Apache是一个整体,php的解析是交给Apache来执行的,只不过需要加载一个php 的模块libphp.so
在LNMP里,PHP会启动一个服务(php-fpm),Nginx会把用户请求的php交给php-fpm服务去进行处理(用户数据与mysql的交互就是由php-fpm来做的,处理好结果以后再告诉Nginx,然后通过Nginx告诉用户的浏览器),用户的静态请求将由Nginx直接进行处理(Nginx在处理静态数据的性能上要比Apache快),
Nginx对静态为主的网站,处理用户并发会很大,速度也会快很多
参照下图进行理解:
# 12.2 MySQL安装 - cd /usr/local/src - wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz - tar zxvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz - mv mysql-5.6.35-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 - 先进入到src 目录下 ,之前我们安装过了mysql, - 这里会先把之前安装的mysql 先删除掉 再重新安装一遍 ``` Last login: Sat Oct 14 19:42:30 2017 [root@localhost ~]# cd /usr/local/src [root@localhost src]# ls apr-1.6.2 httpd-2.4.27.tar.gz php-7.1.6.tar.bz2 apr-1.6.2.tar.gz mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz phpredis-develop apr-util-1.6.0 php-5.6.30 phpredis-develop.zip apr-util-1.6.0.tar.gz php-5.6.30.tar.gz httpd-2.4.27 php-7.1.6 [root@localhost src ``` - 先看下mysql服务有没有启动 ,如果有就先关闭 ``` [root@localhost src]# ps aux |grep mysql root 1290 0.0 0.1 115392 1684 ? S 19:42 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/localhost.localdomain.pid mysql 1541 0.1 46.0 1300792 460400 ? Sl 19:42 0:02 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/localhost.localdomain.err --pid-file=/data/mysql/localhost.localdomain.pid --socket=/tmp/mysql.sock root 2285 0.0 0.0 112680 980 pts/0 S+ 20:08 0:00 grep --color=auto mysq [root@localhost src]# service mysqld stop Shutting down MySQL.. SUCCESS! [root@localhost src]# ps aux |grep mysql root 2326 0.0 0.0 112680 980 pts/0 R+ 20:11 0:00 grep --color=auto mysq [root@localhost src]# ``` - 把之前的mysql目录给删掉,还有把mysqld 启动的脚本给删掉, - 把所有安装包 都统一放到一个路径下/usr/local/src/ 下 ``` [root@localhost src]# rm -rf /usr/local/mysql [root@localhost src]# rm -rf /etc/init.d/mysqld [root@localhost src]# [root@localhost src]# pwd /usr/local/src [root@localhost src]# ``` - 解压, 把文件改名 ``` [root@localhost src]# tar zxvf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz mysql-5.6.36-linux-glibc2.5-x86_64/sql-bench/innotest1b mysql-5.6.36-linux-glibc2.5-x86_64/sql-bench/test-insert mysql-5.6.36-linux-glibc2.5-x86_64/sql-bench/test-select [root@localhost src]# [root@localhost src]# mv mysql-5.6.36-linux-glibc2.5-x86_64 /usr/local/ apache2.4/ apr-util/ etc/ include/ lib64/ php/ sbin/ src/ apr/ bin/ games/ lib/ libexec/ php7/ share/ [root@localhost src]# mv mysql-5.6.36-linux-glibc2.5-x86_64 /usr/local/mysql [root@localhost src]# ls /usr/local/mysql/ bin data include man README share support-files COPYING docs lib mysql-test scripts sql-bench [root@localhost src]# [root@localhost src]# cd /usr/local/mysql/ [root@localhost mysql]# ``` - 需要创建mysql用户,因为之前我们已经创建过了,创建/data/mysql/目录,这个我们也创建了,就把底下的文件删除掉 ``` [root@localhost mysql]# ls /data/ mysql wwwroot [root@localhost mysql]# id mysql uid=1000(mysql) gid=1000(mysql) 组=1000(mysql) [root@localhost mysql]# rm -rf /data/mysql/* [root@localhost mysql]# ``` - 然后j就是初始化 ,初始化的过程就是把一些它启动需要的目录给它生成, ``` [root@localhost mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql New default config file was created as ./my.cnf and will be used by default by the server when you start it. You may edit this file to change server settings WARNING: Default config file /etc/my.cnf exists on the system This file will be read by default by the MySQL server If you do not want to use this, either remove it, or use the --defaults-file argument to mysqld_safe when starting the server [root@localhost mysql]# echo $? 0 [root@localhost mysql]# ``` - 然后再把配置文件拷贝过去,之前已经拷贝过了,编辑配置文件/etc/my.cnf 指定datadir socket位置 ``` [root@localhost mysql]# vim /etc/my.cnf [mysqld] datadir=/data/mysql socket=/tmp/mysql.sock ``` - 然后拷贝一个启动脚本过来,编辑文件 ``` [root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysql [root@localhost mysql]# vim /etc/init.d/mysql # If you change base dir, you must also change datadir. These may get # overwritten by settings in the MySQL configuration files. basedir=/usr/local/mysql datadir=/data/mysql # Default value, in seconds, afterwhich the script should timeout waiting # for server start. # Value here is overriden by value in my.cnf. # 0 means don‘t wait at all :wq ``` - 保存退出后,把服务名字改为mysqld, 这个时候可以尝试 启动了 ``` [root@localhost mysql]# mv /etc/init.d/mysql /etc/init.d/mysqld [root@localhost mysql]# /etc/init.d/mysqld start Starting MySQL.Logging to ‘/data/mysql/localhost.localdomain.err‘. . SUCCESS! [root@localhost mysql]# ps aux |grep mysql root 2591 0.0 0.1 113264 1616 pts/0 S 20:44 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/localhost.localdomain.pid mysql 2728 7.9 44.9 1300792 449556 pts/0 Sl 20:44 0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/localhost.localdomain.err --pid-file=/data/mysql/localhost.localdomain.pid --socket=/tmp/mysql.sock root 2754 0.0 0.0 112680 976 pts/0 S+ 20:44 0:00 grep --color=auto mysq [root@localhost mysql]# ``` - 然后把这个mysqld 加入到服务列表里面去 ``` [root@localhost mysql]# chkconfig --add mysqld [root@localhost mysql]# chkconfig mysqld on [root@localhost mysql]# [root@localhost mysql]# !ps ps aux |grep mysql root 2591 0.0 0.1 113264 1616 pts/0 S 20:44 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/localhost.localdomain.pid mysql 2728 0.4 44.9 1300792 449556 pts/0 Sl 20:44 0:01 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/localhost.localdomain.err --pid-file=/data/mysql/localhost.localdomain.pid --socket=/tmp/mysql.sock root 2794 0.0 0.0 112680 976 pts/0 S+ 20:48 0:00 grep --color=auto mysq [root@localhost mysql]# ``` # 12.3 PHP安装 (上) - 因为php在LNMP和LAMP有差别,在LAMP的时候,他是Apache的模块,需要用apxs2 指定Apache的路径,使用apxs的工具进行自动配置模块的加载 - 在LNMP里,需要指定mysql的路径,但是不需要制动Nginx的路径,因为是LNMP中,PHP是作为一个独立的服务在运行的,和Nginx没有直接的关系,所以他也不需要依赖Nginx的什么东西 - 先进入到src/目录下 ,因为之前编译过PHP,所以只需要进入PHP的目录下执行make clean 把之前编译过的那些文件,全部删掉 ``` [root@localhost ~]# cd /usr/local/src [root@localhost src]# ls apr-1.6.2 httpd-2.4.27.tar.gz php-7.1.6.tar.bz2 apr-1.6.2.tar.gz mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz phpredis-develop apr-util-1.6.0 php-5.6.30 phpredis-develop.zip apr-util-1.6.0.tar.gz php-5.6.30.tar.gz httpd-2.4.27 php-7.1.6 [root@localhost src]# cd php-5.6.30 [root@localhost php-5.6.30]# ls acinclude.m4 main README.PARAMETER_PARSING_API aclocal.m4 makedist README.REDIST.BINS build Makefile README.RELEASE_PROCESS buildconf Makefile.frag README.SELF-CONTAINED-EXTENSIONS buildconf.bat Makefile.fragments README.STREAMS CODING_STANDARDS Makefile.gcov README.SUBMITTING_PATCH config.guess Makefile.global README.TESTING config.log Makefile.objects README.TESTING2 config.nice makerpm README.UNIX-BUILD-SYSTEM config.status meta_ccld README.WIN32-BUILD-SYSTEM config.sub missing run-tests.php configure mkinstalldirs sapi configure.in modules scripts CREDITS netware server-tests-config.php ext NEWS server-tests.php EXTENSIONS pear snapshot footer php5.spec stamp-h.in generated_lists php5.spec.in stub.c genfiles php.gif tests header php.ini-development travis include php.ini-production TSRM INSTALL README.EXT_SKEL UPGRADING install-sh README.GIT-RULES UPGRADING.INTERNALS libphp5.la README.input_filter vcsclean libs README.MAILINGLIST_RULES win32 libtool README.md Zend LICENSE README.namespaces ltmain.sh README.NEW-OUTPUT-API [root@localhost php-5.6.30]# [root@localhost php-5.6.30]# make clean find . -name \*.gcno -o -name \*.gcda | xargs rm -f find . -name \*.lo -o -name \*.o | xargs rm -f find . -name \*.la -o -name \*.a | xargs rm -f find . -name \*.so | xargs rm -f find . -name .libs -a -type d|xargs rm -rf rm -f libphp5.la sapi/cli/php sapi/cgi/php-cgi libphp5.la modules/* libs/* [root@localhost php-5.6.30]# ``` - 现在就是一个刚刚解压的状态,下面来编译针对nginx的编译 - 这时候需要改个名字 叫php-fpm ,因为之前系统里 有php目录,和php7 目录 ``` [root@localhost php-5.6.30]# ls /usr/local/php php/ php7/ [root@localhost php-5.6.30]# ls /usr/local/php bin etc include lib php [root@localhost php-5.6.30]# ls /usr/local/php7 bin etc include lib php var [root@localhost php-5.6.30]# ``` - 下面开始编译 - --prefix=/usr/local/php-fpm 指定路径 ,--with-config-file-path=/usr/local/php-fpm/etc 配置文件所在路径,之前是/php/etc/ 现在是/php-fpm/etc/ , - --enable-fpm 必须需要加上,不加速就没有办法启动这个服务了。 - --with-fpm-user=php-fpm --with-fpm-group=php-fpm 指定它的用户和group - --with-pdo-mysql=/usr/local/mysql 指定mysql 路径 后面的都是之前讲lamp的时候这些都用过, ``` [root@localhost 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 checking whether to enable ctype functions... yes checking for cURL support... yes checking for cURL in default path... not found configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/ [root@localhost php-5.6.30]# echo $? 1 [root@localhost php-5.6.30]# ``` - 有错误,少了一个curl 用yum 安装下 libcurl-devel包 ``` [root@localhost php-5.6.30]# yum install -y libcurl-devel 已加载插件:fastestmirror base | 3.6 kB 00:00:00 已安装: libcurl-devel.x86_64 0:7.29.0-42.el7 作为依赖被升级: curl.x86_64 0:7.29.0-42.el7 libcurl.x86_64 0:7.29.0-42.el7 完毕! [root@localhost php-5.6.30]# 完毕! [root@localhost 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 Thank you for using PHP. config.status: creating php5.spec config.status: creating main/build-defs.h config.status: creating scripts/phpize config.status: creating scripts/man1/phpize.1 config.status: creating scripts/php-config config.status: creating scripts/man1/php-config.1 config.status: creating sapi/cli/php.1 config.status: creating sapi/fpm/php-fpm.conf config.status: creating sapi/fpm/init.d.php-fpm config.status: creating sapi/fpm/php-fpm.service config.status: creating sapi/fpm/php-fpm.8 config.status: creating sapi/fpm/status.html config.status: creating sapi/cgi/php-cgi.1 config.status: creating ext/phar/phar.1 config.status: creating ext/phar/phar.phar.1 config.status: creating main/php_config.h config.status: executing default commands [root@localhost php-5.6.30]# ``` - 由于在之前lamp大部分包都安装过了,现在也不会有太多的错误出现 - make && make install ``` [root@localhost php-5.6.30]# make && make install Installing PEAR environment: /usr/local/php-fpm/lib/php/ [PEAR] Archive_Tar - installed: 1.4.0 [PEAR] Console_Getopt - installed: 1.4.1 [PEAR] Structures_Graph- installed: 1.1.1 [PEAR] XML_Util - installed: 1.3.0 [PEAR] PEAR - installed: 1.10.1 Wrote PEAR system config file at: /usr/local/php-fpm/etc/pear.conf You may want to add: /usr/local/php-fpm/lib/php to your php.ini include_path /usr/local/src/php-5.6.30/build/shtool install -c ext/phar/phar.phar /usr/local/php-fpm/bin ln -s -f phar.phar /usr/local/php-fpm/bin/phar Installing PDO headers: /usr/local/php-fpm/include/php/ext/pdo/ [root@localhost php-5.6.30]# echo $? 0 [root@localhost php-5.6.30]# ``` - 完成,查看下php-fpm 下的文件 比之前php 多了 sbin var ``` [root@localhost php-5.6.30]# ls /usr/local/php-fpm/ bin etc include lib php sbin var [root@localhost php-5.6.30]# ls /usr/local/php/ bin etc include lib php [root@localhost php-5.6.30]# [root@localhost php-5.6.30]# ls /usr/local/php-fpm/sbin/ php-fpm [root@localhost php-5.6.30]# [root@localhost php-5.6.30]# ls /usr/local/php-fpm/var/ log run [root@localhost php-5.6.30]# ``` - log 下面存放日志的,run 下面存放pid的,日志pid 都可以指定 - 可以使用 -m ,-i都是可以的 ``` [root@localhost php-5.6.30]# ls /usr/local/php-fpm/var/log/ [root@localhost php-5.6.30]# ls /usr/local/php-fpm/var/run/ [root@localhost php-5.6.30]# [root@localhost php-5.6.30]# /usr/local/php-fpm/sbin/php-fpm -m [PHP Modules] cgi-fcgi Core ctype curl date dom ereg exif fileinfo filter ftp gd hash iconv json libxml mbstring mcrypt mysql mysqli openssl pcre PDO pdo_mysql pdo_sqlite Phar posix Reflection session SimpleXML soap SPL sqlite3 standard tokenizer xml xmlreader xmlwriter zlib [Zend Modules] [root@localhost php-5.6.30]# /usr/local/php-fpm/sbin/php-fpm -i PHP License This program is free software; you can redistribute it and/or modify it under the terms of the PHP License as published by the PHP Group and included in the distribution in the file: LICENSE This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. If you did not receive a copy of the PHP license, or have any questions about PHP licensing, please contact license@php.net. [root@localhost php-5.6.30]# ``` - /usr/local/php-fpm/sbin/php-fpm -t 这个用来测试 他自己配置文件的语法的 - 也可以看到 用-t 最后发现,这配置文件php-fpm.conf不存在,也就是说你要想启动php-fpm的服务,你首先要给它配置 配置文件 ``` [root@localhost php-5.6.30]# /usr/local/php-fpm/sbin/php-fpm -t [14-Oct-2017 22:03:35] ERROR: failed to open configuration file ‘/usr/local/php-fpm/etc/php-fpm.conf‘: No such file or directory (2) [14-Oct-2017 22:03:35] ERROR: failed to load configuration file ‘/usr/local/php-fpm/etc/php-fpm.conf‘ [14-Oct-2017 22:03:35] ERROR: FPM initialization failed [root@localhost php-5.6.30]# ``` - 下面来配置这个服务,让这个服务起来 - cp php.ini-production /usr/local/php-fpm/etc/php.ini 把这个php.ini 先做一个拷贝,咱们已经制定了它的配置文件 所在的路径在/php-fpm/etc/php.ini,所有需要把这个配置文件给拷贝过去, ``` [root@localhost php-5.6.30]# ls /usr/local/php-fpm/etc/ pear.conf php-fpm.conf.default [root@localhost php-5.6.30]# ``` - etc目录下是没有php.ini的 - php.ini-development php.ini-production ,一个是开发环境中,一个是生产环境中用,假如你做了一个lnmp环境,这个环境是给开发人员用的,也就是你测试的用, - 如果是正式线上的 用php.ini-production ``` [root@localhost php-5.6.30]# p php.ini- php.ini-development php.ini-production [root@localhost php-5.6.30]# cp php.ini-development /usr/local/php-fpm/etc/php.ini [root@localhost php-5.6.30]# ``` - 创建一个 php-fpm.conf 直接写入,加上一些内容 ``` [root@localhost php-5.6.30]# cd /usr/local/php-fpm/etc/ [root@localhost etc]# ls pear.conf php-fpm.conf.default php.ini [root@localhost etc]# vim php-fpm.conf [root@localhost etc]# vim php-fpm.conf [global] pid = /usr/local/php-fpm/var/run/php-fpm.pid error_log = /usr/local/php-fpm/var/log/php-fpm.log [www] listen = /tmp/php-fcgi.sock #listen = 127.0.0.1:9000 listen.mode = 666 user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024 ~ ~ :wq ``` - 下面拷贝启动的脚本 ``` [root@localhost etc]# cd /usr/local/src/php-5.6.30/ [root@localhost php-5.6.30]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm [root@localhost php-5.6.30]# ``` - 改下权限, 启动服务 提示错误 cannot get uid for user ‘php-fpm‘ php-fpm这个用户不存在 ``` [root@localhost php-5.6.30]# chmod 755 /etc/init.d/php-fpm [root@localhost php-5.6.30]# chkconfig --add php-fpm [root@localhost php-5.6.30]# chkconfig php-fpm on [root@localhost php-5.6.30]# service php-fpm start Starting php-fpm [14-Oct-2017 22:35:15] NOTICE: PHP message: PHP Deprecated: Comments starting with ‘#‘ are deprecated in Unknown on line 1 in Unknown on line 0 [14-Oct-2017 22:35:15] ERROR: [pool www] cannot get uid for user ‘php-fpm‘ [14-Oct-2017 22:35:15] ERROR: FPM initialization failed failed [root@localhost php-5.6.30]# ``` - 做个检测看看有没有错 ``` [root@localhost php-5.6.30]# /usr/local/php-fpm/sbin/php-fpm -t [14-Oct-2017 22:36:01] NOTICE: PHP message: PHP Deprecated: Comments starting with ‘#‘ are deprecated in Unknown on line 1 in Unknown on line 0 [14-Oct-2017 22:36:01] NOTICE: configuration file /usr/local/php-fpm/etc/php-fpm.conf test is successful [root@localhost php-5.6.30]# ``` - 提示错误 cannot get uid for user ‘php-fpm‘ php-fpm这个用户不存在 - 添加一个一个用户php-fpm ,再来启动 ``` [root@localhost php-5.6.30]# useradd php-fpm [root@localhost php-5.6.30]# [root@localhost php-5.6.30]# service php-fpm start Starting php-fpm [14-Oct-2017 22:38:46] NOTICE: PHP message: PHP Deprecated: Comments starting with ‘#‘ are deprecated in Unknown on line 1 in Unknown on line 0 done [root@localhost php-5.6.30]# [root@localhost php-5.6.30]# ps aux |grep php-fpm root 118681 0.0 0.4 123564 4936 ? Ss 22:38 0:00 php-fpm: master process (/usr/local/php-fpm/etc/php-fpm.conf) php-fpm 118682 0.0 0.4 123564 4712 ? S 22:38 0:00 php-fpm: pool www php-fpm 118683 0.0 0.4 123564 4712 ? S 22:38 0:00 php-fpm: pool www php-fpm 118684 0.0 0.4 123564 4712 ? S 22:38 0:00 php-fpm: pool www php-fpm 118685 0.0 0.4 123564 4712 ? S 22:38 0:00 php-fpm: pool www php-fpm 118686 0.0 0.4 123564 4716 ? S 22:38 0:00 php-fpm: pool www php-fpm 118687 0.0 0.4 123564 4716 ? S 22:38 0:00 php-fpm: pool www php-fpm 118688 0.0 0.4 123564 4716 ? S 22:38 0:00 php-fpm: pool www php-fpm 118689 0.0 0.4 123564 4716 ? S 22:38 0:00 php-fpm: pool www php-fpm 118690 0.0 0.4 123564 4716 ? S 22:38 0:00 php-fpm: pool www php-fpm 118691 0.0 0.4 123564 4716 ? S 22:38 0:00 php-fpm: pool www php-fpm 118692 0.0 0.4 123564 4716 ? S 22:38 0:00 php-fpm: pool www php-fpm 118693 0.0 0.4 123564 4720 ? S 22:38 0:00 php-fpm: pool www php-fpm 118694 0.0 0.4 123564 4720 ? S 22:38 0:00 php-fpm: pool www php-fpm 118695 0.0 0.4 123564 4720 ? S 22:38 0:00 php-fpm: pool www php-fpm 118696 0.0 0.4 123564 4720 ? S 22:38 0:00 php-fpm: pool www php-fpm 118697 0.0 0.4 123564 4720 ? S 22:38 0:00 php-fpm: pool www php-fpm 118698 0.0 0.4 123564 4720 ? S 22:38 0:00 php-fpm: pool www php-fpm 118699 0.0 0.4 123564 4720 ? S 22:38 0:00 php-fpm: pool www php-fpm 118700 0.0 0.4 123564 4720 ? S 22:38 0:00 php-fpm: pool www php-fpm 118701 0.0 0.4 123564 4720 ? S 22:38 0:00 php-fpm: pool www root 118703 0.0 0.0 112680 980 pts/0 R+ 22:39 0:00 grep --color=auto php-fpm [root@localhost php-5.6.30]# [root@localhost php-5.6.30]# vim /usr/local/php-fpm/etc/php-fpm.conf [root@localhost php-5.6.30]# ls -l /tmp/php-fcgi.sock srw-rw-rw-. 1 root root 0 10月 14 22:38 /tmp/php-fcgi.sock [root@localhost php-5.6.30]# ``` - php也安装完了 服务也启动起来了 # 12.5 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 ### - 扩展 - Nginx为什么比Apache Httpd高效:原理篇 http://www.toxingwang.com/linux-unix/linux-basic/1712.html - apache和nginx工作原理比较 http://www.server110.com/nginx/201402/6543.html - mod_php 和 mod_fastcgi以及php-fpm的比较 http://dwz.cn/1lwMSd - 概念了解:CGI,FastCGI,PHP-CGI与PHP-FPMhttp://www.nowamagic.net/librarys/veda/detail/1319/ https://www.awaimai.com/371.html
12.1LNMP架构介绍12.2 MySQL安装12.3/12.4 PHP安装12.5 Nginx介绍
标签:12.1lnmp架构介绍12.2 mysql安装12.3/12.4 php安装12.5 nginx介绍
原文地址:http://ch71smas.blog.51cto.com/13090095/1973945