4.26 Alias
Alias别名:
1一条命令的另外一个名字,你可以理解为外号。 2举例: 3 网卡配置文件路径很长,每次敲这个命令都要花很长时间,可以做一个别名: 4 alias viens33='vi /etc/sysconfig/network-scripts/ifcfg-ens33' 5vi ~/.bashrc //针对当前用户的,换一个用户就不好使了 6vi /etc/bashrc //针对所有用户,不仅仅是当前用户。 7 在这个文件最后面增加:alias viens33='vi /etc/sysconfig/network-scripts/ifcfg-ens33'
4.27-29 php编译安装
下载PHP
1cd /usr/local/src 2wget http://cn2.php.net/distributions/php-7.3.0.tar.bz2
解压
tar jxvf php-7.3.0.tar.bz2
编译
1cd php-7.3.0 2编译参数: 3./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 4 5make 6make install
配置文件:
1cd /usr/local/php-fpm/ 2cp php-fpm.conf.default php-fpm.conf 3cd /usr/local/src/php-7.3.0 4cp php.ini-development /usr/local/php-fpm/etc/php.ini 5cd /usr/local/php-fpm/etc/php-fpm.d/ 6cp www.conf.default www.conf
启动脚本:
1cd /usr/local/src/php-7.3.0 2cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm 3chkconfig --add php-fpm 4chkconfig php-fpm on 5chmod 755 /etc/init.d/php-fpm
补充:
1vi 里面在一般模式下,按dd可以删除行(剪切),5dd(剪切5行),光标挪到要粘贴的位置,按p。 2操作错误之后,想要撤销,可以按u,反着撤销按 ctrl r; 3一般模式下按gg可以把光标定位到首行,按G可以定位到末行; 4按yy复制,5yy复制5行; 5显示行号,在一般模式里输入:set nu; 6定位到指定的行:一般模式下直接按数字G,如10G
编译安装一个软件包的步骤:
1./configure ; make; make install 2 3grep -i 忽略大小写
错误1:
1checking for cc... no 2checking for gcc... no 3解决: yum install -y gcc
错误2:
1error: libxml2 not found 2解决:yum install -y libxml2-devel
错误3:
1error: Cannot find OpenSSL's 2解决:yum install -y openssl-devel
错误4:
1error: cURL version 7.15.5 or later is required 2解决:yum install -y libcurl-devel
错误5:
1configure: error: jpeglib.h not found 2解决:yum install -y libjpeg-turbo-devel
错误6:
1configure: error: png.h not found 2解决:yum install -y libpng-devel
错误7:
1configure: error: freetype-config not found. 2解决: yum install -y freetype-devel
错误8:
1configure: error: wrong mysql library version or lib not found 2解决:下载一个低版本的MySQL/Mariadb 3wget http://mirrors.163.com/mysql/Downloads/MySQL-5.6/mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz 4tar jxvf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz 5mv mysql-5.6.39-linux-glibc2.12-x86_64 /usr/local/mysql5.6 6改编译参数 7./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/mysql5.7 --with-mysqli=/usr/local/mysql5.7/bin/mysql_config --with-pdo-mysql=/usr/local/mysql5.7 --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
错误9:
1ERROR: [pool www] cannot get uid for user 'php-fpm' 2解决:useradd php-fpm
补充:
diff 查看两个文件的差异的,如 diff 1.txt 2.txt
4.30 编译安装Nginx
官方文档:http://nginx.org/en/docs/install.html
下载:
wget http://nginx.org/download/nginx-1.14.2.tar.gz
解压:
1tar zxvf nginx-1.14.2.tar.gz 2cd nginx-1.14.2
编译:
1./configure --prefix=/usr/local/nginx --with-http_ssl_module 2make && make install
启动:
/usr/local/nginx/sbin/nginx
- © 2019 GitHub, Inc.
代码:
1[root@test01 ~]# cd /usr/local/src 2[root@test01 src]# ls 3mariadb-10.3.12-linux-x86_64.tar.gz 4[root@test01 src]# wget http://cn2.php.net/distributions/php-7.3.1.tar.bz2 5--2019-01-25 22:31:11-- http://cn2.php.net/distributions/php-7.3.1.tar.bz2 6正在解析主机 cn2.php.net (cn2.php.net)... 36.51.255.144 7正在连接 cn2.php.net (cn2.php.net)|36.51.255.144|:80... 已连接。 8已发出 HTTP 请求,正在等待回应... 200 OK 9长度:14812823 (14M) [application/octet-stream] 10正在保存至: “php-7.3.1.tar.bz2” 11 12100%[===============================================>] 14,812,823 484KB/s 用时 52s 13 142019-01-25 22:32:04 (276 KB/s) - 已保存 “php-7.3.1.tar.bz2” [14812823/14812823]) 15 16[root@test01 src]# ls 17mariadb-10.3.12-linux-x86_64.tar.gz php-7.3.1.tar.bz2 18 19[root@test01 src]# ls 20mariadb-10.3.12-linux-x86_64.tar.gz php-7.3.1.tar.bz2 21 22[root@test01 src]# tar jxvf php-7.3.1.tar.bz2 提示没有安装bzip2 23tar (child): bzip2:无法 exec: 没有那个文件或目录 24tar (child): Error is not recoverable: exiting now 25tar: Child returned status 2 26tar: Error is not recoverable: exiting now 27[root@test01 src]# yum install -y bzip2 |less 安装一下 28[root@test01 src]# tar jxf php-7.3.1.tar.bz2 29[root@test01 src]# ls 30mariadb-10.3.12-linux-x86_64.tar.gz php-7.3.1 php-7.3.1.tar.bz2 31[root@test01 src]# 32 33[root@test01 src]# cd php-7.3.1 34[root@test01 php-7.3.1]# ls 35acinclude.m4 ltmain.sh README.RELEASE_PROCESS 36aclocal.m4 main README.SELF-CONTAINED-EXTENSIONS 37appveyor makedist README.STREAMS 38build Makefile.frag README.SUBMITTING_PATCH 39buildconf Makefile.gcov README.TESTING 40buildconf.bat Makefile.global README.UNIX-BUILD-SYSTEM 41CODING_STANDARDS missing README.WIN32-BUILD-SYSTEM 42config.guess mkinstalldirs run-tests.php 43config.sub NEWS sapi 44configure pear scripts 45configure.ac php7.spec.in server-tests-config.php 46CONTRIBUTING.md php.gif server-tests.php 47CREDITS php.ini-development snapshot 48ext php.ini-production stamp-h.in 49EXTENSIONS README.EXT_SKEL tests 50footer README.GIT-RULES travis 51generated_lists README.input_filter TSRM 52genfiles README.MAILINGLIST_RULES UPGRADING 53header README.md UPGRADING.INTERNALS 54INSTALL README.NEW-OUTPUT-API vcsclean 55install-sh README.PARAMETER_PARSING_API win32 56LICENSE README.REDIST.BINS Zend 57[root@test01 php-7.3.1]# [root@test01 php-7.3.1]# ./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 58configure: WARNING: unrecognized options: --with-mysql, --with-mcrypt, --enable-gd-native-ttf 59checking for grep that handles long lines and -e... /usr/bin/grep 60checking for egrep... /usr/bin/grep -E 61checking for a sed that does not truncate output... /usr/bin/sed 62checking build system type... x86_64-pc-linux-gnu 63checking host system type... x86_64-pc-linux-gnu 64checking target system type... x86_64-pc-linux-gnu 65checking for cc... no 66checking for gcc... no 67configure: error: in `/usr/local/src/php-7.3.1': 68configure: error: no acceptable C compiler found in $PATH 69See `config.log' for more details 70错误1:缺少gcc这个包 71[root@test01 php-7.3.1]#yum install -y gcc安装一下 72 73错误2:缺少libxm12包 74configure: error: libxml2 not found. Please check your libxml2 installation. 75 76[root@test01 php-7.3.1]# yum list |grep libxml2 搜索一下 77libxml2.x86_64 2.9.1-6.el7_2.3 @anaconda 78libxml2-python.x86_64 2.9.1-6.el7_2.3 @base 79libxml2.i686 2.9.1-6.el7_2.3 base 80libxml2-devel.i686 2.9.1-6.el7_2.3 base 81libxml2-devel.x86_64 2.9.1-6.el7_2.3 base 82libxml2-static.i686 2.9.1-6.el7_2.3 base 83libxml2-static.x86_64 2.9.1-6.el7_2.3 base 84 85[root@test01 php-7.3.1]# echo $? 861 87 88[root@test01 php-7.3.1]# yum install -y libxml2-devel 安装一下 89 90错误3:缺少Openssl 91configure: error: Cannot find OpenSSL's <evp.h> 92 93 94[root@test01 php-7.3.1]# yum list |grep -i openssl grep匹配搜索-i忽略大小写 95openssl.x86_64 1:1.0.1e-60.el7 @anaconda 96openssl-libs.x86_64 1:1.0.1e-60.el7 @anaconda 97apr-util-openssl.x86_64 1.5.2-6.el7 base 98openssl.x86_64 1:1.0.2k-16.el7 base 99openssl-devel.i686 1:1.0.2k-16.el7 base 100openssl-devel.x86_64 1:1.0.2k-16.el7 base 101openssl-libs.i686 1:1.0.2k-16.el7 base 102openssl-libs.x86_64 1:1.0.2k-16.el7 base 103openssl-perl.x86_64 1:1.0.2k-16.el7 base 104openssl-static.i686 1:1.0.2k-16.el7 base 105openssl-static.x86_64 1:1.0.2k-16.el7 base 106openssl098e.i686 0.9.8e-29.el7.centos.3 base 107openssl098e.x86_64 0.9.8e-29.el7.centos.3 base 108perl-Crypt-OpenSSL-Bignum.x86_64 0.04-18.el7 base 109perl-Crypt-OpenSSL-RSA.x86_64 0.28-7.el7 base 110perl-Crypt-OpenSSL-Random.x86_64 0.04-21.el7 base 111pyOpenSSL.x86_64 0.13.1-4.el7 base 112pyOpenSSL-doc.noarch 0.13.1-4.el7 base 113xmlsec1-openssl.i686 1.2.20-7.el7_4 base 114xmlsec1-openssl.x86_64 1.2.20-7.el7_4 base 115xmlsec1-openssl-devel.i686 1.2.20-7.el7_4 base 116xmlsec1-openssl-devel.x86_64 1.2.20-7.el7_4 base 117 118[root@test01 php-7.3.1]# yum install -y openssl-devel 安装一下 119 120错误4: error: cURL version 7.15.5 or later is required to compile php with cURL support 121 122[root@test01 php-7.3.1]# yum list |grep -i curl 123curl.x86_64 7.29.0-51.el7 @base 124libcurl.x86_64 7.29.0-51.el7 @base 125python-pycurl.x86_64 7.19.0-19.el7 @anaconda 126libcurl.i686 7.29.0-51.el7 base 127libcurl-devel.i686 7.29.0-51.el7 base 128libcurl-devel.x86_64 7.29.0-51.el7 base 129perl-WWW-Curl.x86_64 4.15-13.el7 base 130 131[root@test01 php-7.3.1]# yum install -y libcurl-devel 安装一下 132 133错误5:error: jpeglib.h not found. 134 135[root@test01 php-7.3.1]# yum list |grep -i jpeg 136libjpeg-turbo.x86_64 1.2.90-5.el7 @anaconda 137libjpeg-turbo.i686 1.2.90-6.el7 base 138libjpeg-turbo.x86_64 1.2.90-6.el7 base 139libjpeg-turbo-devel.i686 1.2.90-6.el7 base 140libjpeg-turbo-devel.x86_64 1.2.90-6.el7 base 141libjpeg-turbo-static.i686 1.2.90-6.el7 base 142libjpeg-turbo-static.x86_64 1.2.90-6.el7 base 143libjpeg-turbo-utils.x86_64 1.2.90-6.el7 base 144openjpeg.x86_64 1.5.1-18.el7 base 145openjpeg-devel.i686 1.5.1-18.el7 base 146openjpeg-devel.x86_64 1.5.1-18.el7 base 147openjpeg-libs.i686 1.5.1-18.el7 base 148openjpeg-libs.x86_64 1.5.1-18.el7 base 149turbojpeg.i686 1.2.90-6.el7 base 150turbojpeg.x86_64 1.2.90-6.el7 base 151turbojpeg-devel.i686 1.2.90-6.el7 base 152turbojpeg-devel.x86_64 1.2.90-6.el7 base 153 154[root@test01 php-7.3.1]# yum install -y libjpeg-turbo-devel 155 156 157错误6:error: png.h not found. 158 159[root@test01 php-7.3.1]# yum list |grep png 160libpng.x86_64 2:1.5.13-7.el7_2 @anaconda 161libpng.i686 2:1.5.13-7.el7_2 base 162libpng-devel.i686 2:1.5.13-7.el7_2 base 163libpng-devel.x86_64 2:1.5.13-7.el7_2 base 164libpng-static.i686 2:1.5.13-7.el7_2 base 165libpng-static.x86_64 2:1.5.13-7.el7_2 base 166libpng12.i686 1.2.50-10.el7 base 167libpng12.x86_64 1.2.50-10.el7 base 168libpng12-devel.i686 1.2.50-10.el7 base 169libpng12-devel.x86_64 1.2.50-10.el7 base 170optipng.x86_64 0.7.4-4.el7 base 171pngcrush.x86_64 1.7.59-4.el7 base 172pngnq.x86_64 1.1-9.el7 base 173texlive-dvipng.noarch 2:svn26689.1.14-43.el7 base 174texlive-dvipng-bin.x86_64 2:svn26509.0-43.20130427_r30134.el7 175texlive-dvipng-doc.noarch 2:svn26689.1.14-43.el7 base 176 177 178[root@test01 php-7.3.1]# yum list |grep png|grep devel 可以连续grep匹配多次 179libpng-devel.i686 2:1.5.13-7.el7_2 base 180libpng-devel.x86_64 2:1.5.13-7.el7_2 base 181libpng12-devel.i686 1.2.50-10.el7 base 182libpng12-devel.x86_64 1.2.50-10.el7 base 183 184[root@test01 php-7.3.1]# yum install -y libpng-devel 185 186错误7:error: freetype-config not found. 187, 188[root@test01 php-7.3.1]# yum list |grep freetype 189freetype.x86_64 2.4.11-12.el7 @anaconda 190freetype.i686 2.8-12.el7 base 191freetype.x86_64 2.8-12.el7 base 192freetype-demos.x86_64 2.8-12.el7 base 193freetype-devel.i686 2.8-12.el7 base 194freetype-devel.x86_64 2.8-12.el7 base 195[root@test01 php-7.3.1]# yum install -y freetype-devel 196 197错误8:error: wrong mysql library version or lib not found. Check config.log for more information. 提示mysql版本不匹配 198下载一个低版本的mysql/mariadb 199也可以去掉编译中的--with-mysql=/usr/local/mysql 结果这个方法没用 200 201[root@test01 src]# wget http://mirrors.163.com/mysql/Downloads/MySQL-5.7/mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz 下载一个5.7的mysql 202 203[root@test01 src]# tar zxf mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz 解压不加v不显示过程 204[root@test01 src]# mv mysql-5.7.23-linux-glibc2.12-x86_64 /usr/local/mysql5.7 205[root@test01 php-7.3.1]# cd php-7.3.1 206[root@test01 php-7.3.1]# ./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/mysql5.7 --with-mysqli=/usr/local/mysql5.7/bin/mysql_config --with-pdo-mysql=/usr/local/mysql5.7 --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 207改mysql的路径改成5.7 208 209configure: WARNING: unrecognized options: --with-mysql, --with-mcrypt, --enable-gd-native-ttf 210 211 212 213 214 215[root@test01 php-7.3.1]# echo $? 2160 217 218[root@test01 php-7.3.1]# make 把源码包变成二进制包 219 220[root@test01 php-7.3.1]# echo $? 2210 222[root@test01 php-7.3.1]# make install 223[root@test01 php-7.3.1]# echo $? 2240 225如果要卸载的话。rm -rvf /usr/local/php-fpm/卸载掉,用history可以查看装了多少rpm包,也可以卸载掉这些安装的rpm包,但其实影响不大,不用去remove也没关系 226 227[root@test01 php-7.3.1]# ls /usr/local/php-fpm/ 228bin etc include lib php sbin var 229 230[root@test01 php-7.3.1]# cd !$ 231cd /usr/local/php-fpm/ 232[root@test01 php-7.3.1]# ls 233bin etc include lib php sbin var 234[root@test01 php-fpm]# cd etc/ 235[root@test01 etc]# ls 236pear.conf php-fpm.conf.default php-fpm.d 237 238[root@test01 etc]# cp php-fpm.conf.default php-fpm.conf 拷贝生成模板配置文件,不然Php没办法启动 239 240[root@test01 etc]# ls 241pear.conf php-fpm.conf php-fpm.conf.default php-fpm.d 242 243[root@test01 etc]# cd /usr/local/src/php-7.3.1 244[root@test01 php-7.3.1]# ls 245acinclude.m4 libtool README.NEW-OUTPUT-API 246aclocal.m4 LICENSE README.PARAMETER_PARSING_API 247appveyor ltmain.sh README.REDIST.BINS 248build main README.RELEASE_PROCESS 249buildconf makedist README.SELF-CONTAINED-EXTENSIONS 250buildconf.bat Makefile README.STREAMS 251CODING_STANDARDS Makefile.frag README.SUBMITTING_PATCH 252config.guess Makefile.fragments README.TESTING 253config.log Makefile.gcov README.UNIX-BUILD-SYSTEM 254config.nice Makefile.global README.WIN32-BUILD-SYSTEM 255config.status Makefile.objects run-tests.php 256config.sub missing sapi 257configure mkinstalldirs scripts 258configure.ac modules server-tests-config.php 259CONTRIBUTING.md NEWS server-tests.php 260CREDITS pear snapshot 261ext php7.spec stamp-h.in 262EXTENSIONS php7.spec.in tests 263footer php.gif travis 264generated_lists php.ini-development TSRM 265genfiles php.ini-production UPGRADING 266header README.EXT_SKEL UPGRADING.INTERNALS 267include README.GIT-RULES vcsclean 268INSTALL README.input_filter win32 269install-sh README.MAILINGLIST_RULES Zend 270libs README.md 271 272[root@test01 php-7.3.1]# diff php.ini-development php.ini-production (左)测试及开发用配置文件,(右)生产用配置文件。比较两个配置文件有哪些地方有不同 27386c86 274< ; This is the php.ini-development INI file. 275--- 276> ; This is the php.ini-production INI file. 277155a156,160 278> ; track_errors 279> ; Default Value: Off 280> ; Development Value: On 281> ; Production Value: Off 282> 283455c460 284< error_reporting = E_ALL 285--- 286> error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT 287472c477 288< display_errors = On 289--- 290> display_errors = Off 291483c488 292< display_startup_errors = On 293--- 294> display_startup_errors = Off 295520c525,527 296< ; Store the last error/warning message in $php_errormsg (boolean). 297--- 298> ; Store the last error/warning message in $php_errormsg (boolean). Setting this value 299> ; to On can assist in debugging and is appropriate for development servers. It should 300> ; however be disabled on production servers. 3011201c1208 302< mysqlnd.collect_memory_statistics = On 303--- 304> mysqlnd.collect_memory_statistics = Off 3051580c1587 306< zend.assertions = 1 307--- 308> zend.assertions = -1 3091886c1893 310< ;opcache.huge_code_pages=0 311--- 312> ;opcache.huge_code_pages=1 313 314[root@test01 php-7.3.1]# cp php.ini-development /usr/local/php-fpm/etc/php.ini把另一个模板配置文件拷贝到/usr/local/php-fpm/etc/下。一共两个配置文件,一个是服务本身的配置文件,一个是php的配置文件 315[root@test01 php-7.3.1]# 316 317[root@test01 php-7.3.1]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm 拷贝启动脚本 318 319[root@test01 php-7.3.1]# chkconfig --add php-fpm 320[root@test01 php-7.3.1]# chkconfig --list 321 322注意:该输出结果只显示 SysV 服务,并不包含原生 systemd 服务。SysV 配置数据可能被原生 systemd 配置覆盖。 323 如果您想列出 systemd 服务,请执行 'systemctl list-unit-files'。 324 欲查看对特定 target 启用的服务请执行 325 'systemctl list-dependencies [target]'。 326 327mysqld 0:关 1:关 2:开 3:开 4:开 5:开 6:关 328netconsole 0:关 1:关 2:关 3:关 4:关 5:关 6:关 329network 0:关 1:关 2:开 3:开 4:开 5:开 6:关 330php-fpm 0:关 1:关 2:开 3:开 4:开 5:开 6:关 331[root@test01 php-7.3.1]# chkconfig php-fpm on 332[root@test01 php-7.3.1]# chkconfig --list 333 334注意:该输出结果只显示 SysV 服务,并不包含原生 systemd 服务。SysV 配置数据可能被原生 systemd 配置覆盖。 335 如果您想列出 systemd 服务,请执行 'systemctl list-unit-files'。 336 欲查看对特定 target 启用的服务请执行 337 'systemctl list-dependencies [target]'。 338 339mysqld 0:关 1:关 2:开 3:开 4:开 5:开 6:关 340netconsole 0:关 1:关 2:关 3:关 4:关 5:关 6:关 341network 0:关 1:关 2:开 3:开 4:开 5:开 6:关 342php-fpm 0:关 1:关 2:开 3:开 4:开 5:开 6:关 343 344[root@test01 php-7.3.1]# service php-fpm start 345Unit php-fpm.service could not be found. 346env: /etc/init.d/php-fpm: 权限不够 347[root@test01 php-7.3.1]# chmod 755 /etc/init.d/php-fpm 348[root@test01 php-7.3.1]# service php-fpm start 349Unit php-fpm.service could not be found. 350Starting php-fpm [26-Jan-2019 01:15:26] WARNING: Nothing matches the include pattern '/usr/local/php-fpm/etc/php-fpm.d/*.conf' from /usr/local/php-fpm/etc/php-fpm.conf at line 143. 351[26-Jan-2019 01:15:26] ERROR: No pool defined. at least one pool section must be specified in config file 352[26-Jan-2019 01:15:26] ERROR: failed to post process the configuration 353[26-Jan-2019 01:15:26] ERROR: FPM initialization failed 354 failed 定义配置池子 355 356[root@test01 php-7.3.1]# vi /usr/local/php-fpm/etc/php-fpm.conf 定位到143行 357 358[1]+ 已停止 vi /usr/local/php-fpm/etc/php-fpm.conf 359[root@test01 php-7.3.1]# cd /usr/local/php-fpm/etc/php-fpm.d/ 360[root@test01 php-fpm.d]# ls 361www.conf.default 362[root@test01 php-fpm.d]# cp www.conf.default www.conf 363[root@test01 php-fpm.d]# ls 364www.conf www.conf.default 365 366[root@test01 php-fpm.d]# service php-fpm start 367Unit php-fpm.service could not be found. 368Starting php-fpm [26-Jan-2019 01:23:36] ERROR: [pool www] cannot get uid for user 'php-fpm' 369[26-Jan-2019 01:23:36] ERROR: FPM initialization failed 370 failed 没有php-fpm这个用户 371[root@test01 php-fpm.d]# useradd php-fpm 372[root@test01 php-fpm.d]# service php-fpm start 373Unit php-fpm.service could not be found. 374Starting php-fpm done 375 376[root@test01 php-fpm.d]# ps aux |grep php-fpm 377root 52445 0.0 0.1 126348 1704 pts/1 T 01:17 0:00 vi /usr/local/php-fpm/etc/php-fpm.conf 378root 52482 0.0 0.6 127148 6196 ? Ss 01:26 0:00 php-fpm: master process (/usr/local/php-fpm/etc/php-fpm.conf) 379php-fpm 52483 0.0 0.6 127148 6104 ? S 01:26 0:00 php-fpm: pool www 380php-fpm 52484 0.0 0.6 127148 6104 ? S 01:26 0:00 php-fpm: pool www 381root 52487 0.0 0.0 112728 980 pts/1 R+ 01:27 0:00 grep --color=auto php-fpm 382[root@test01 php-fpm.d]# netstat -lntp 383Active Internet connections (only servers) 384Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name 385tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 973/sshd 386tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1253/master 387tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 52482/php-fpm: mast 388tcp6 0 0 :::3306 :::* LISTEN 3244/mysqld 389tcp6 0 0 :::22 :::* LISTEN 973/sshd 390tcp6 0 0 ::1:25 :::* LISTEN 1253/master 391 392 393 394编译安装nginx 395 396[root@test01 php-fpm.d]# cd /usr/local/src/ 397[root@test01 src]# ls 398mariadb-10.3.12-linux-x86_64.tar.gz php-7.3.1 399mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz php-7.3.1.tar.bz2 400[root@test01 src]# wget http://120.52.51.15/nginx.org/download/nginx-1.14.2.tar.gz 401--2019-01-26 01:32:39-- http://120.52.51.15/nginx.org/download/nginx-1.14.2.tar.gz 402正在连接 120.52.51.15:80... 已连接。 403已发出 HTTP 请求,正在等待回应... 200 OK 404长度:1015384 (992K) [application/octet-stream] 405正在保存至: “nginx-1.14.2.tar.gz” 406 407100%[===============================================>] 1,015,384 536KB/s 用时 1.8s 408 4092019-01-26 01:32:41 (536 KB/s) - 已保存 “nginx-1.14.2.tar.gz” [1015384/1015384]) 410 411 412[root@test01 src]# tar zxf nginx-1.14.2.tar.gz 413[root@test01 src]# cd nginx-1.14.2 414[root@test01 nginx-1.14.2]# ls 415auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src 416[root@test01 nginx-1.14.2]# 417 418[root@test01 nginx-1.14.2]# ./configure --prefix=/usr/local/nginx --with-http_ssl_module 419[root@test01 nginx-1.14.2]# echo $? 4200 421[root@test01 nginx-1.14.2]# make && install 意思是前面的命令成功才会运行后面的命令,如果不成功不运行。 422[root@test01 nginx-1.14.2]# echo $? 4230 424 425[root@test01 conf]# /usr/local/nginx/sbin/nginx 启动nginx 没有启动脚本不太好管理 426[root@test01 conf]# ps aux |grep nginx 427root 55077 0.0 0.1 45844 1128 ? Ss 01:46 0:00 nginx: master process /usr/local/nginx/sbin/nginx 428nobody 55078 0.0 0.1 46292 1896 ? S 01:46 0:00 nginx: worker process 429root 55080 0.0 0.0 112728 980 pts/1 R+ 01:46 0:00 grep --color=auto ngin 430[root@test01 conf]# netstat -ltnp |grep nginx 431tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 55077/nginx: master 432[root@test01 conf]# /usr/local/nginx/sbin/nginx 配置文件路径 433[root@test01 conf]# vi nginx.conf