4.26 Alias
Alias别名:
一条命令的另外一个名字,你可以理解为外号。
举例:
网卡配置文件路径很长,每次敲这个命令都要花很长时间,可以做一个别名:
alias viens33='vi /etc/sysconfig/network-scripts/ifcfg-ens33'
vi ~/.bashrc //针对当前用户的,换一个用户就不好使了
vi /etc/bashrc //针对所有用户,不仅仅是当前用户。
在这个文件最后面增加:alias viens33='vi /etc/sysconfig/network-scripts/ifcfg-ens33'
4.27-29 php编译安装
下载PHP
cd /usr/local/src
wget http://cn2.php.net/distributions/php-7.3.0.tar.bz2
解压
tar jxvf php-7.3.0.tar.bz2
编译
cd php-7.3.0
编译参数:
./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
配置文件:
cd /usr/local/php-fpm/
cp php-fpm.conf.default php-fpm.conf
cd /usr/local/src/php-7.3.0
cp php.ini-development /usr/local/php-fpm/etc/php.ini
cd /usr/local/php-fpm/etc/php-fpm.d/
cp www.conf.default www.conf
启动脚本:
cd /usr/local/src/php-7.3.0
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on
chmod 755 /etc/init.d/php-fpm
补充:
vi 里面在一般模式下,按dd可以删除行(剪切),5dd(剪切5行),光标挪到要粘贴的位置,按p。
操作错误之后,想要撤销,可以按u,反着撤销按 ctrl r;
一般模式下按gg可以把光标定位到首行,按G可以定位到末行;
按yy复制,5yy复制5行;
显示行号,在一般模式里输入:set nu;
定位到指定的行:一般模式下直接按数字G,如10G
编译安装一个软件包的步骤:
./configure ; make; make install
grep -i 忽略大小写
错误1:
checking for cc... no
checking for gcc... no
解决: yum install -y gcc
错误2:
error: libxml2 not found
解决:yum install -y libxml2-devel
错误3:
error: Cannot find OpenSSL's
解决:yum install -y openssl-devel
错误4:
error: cURL version 7.15.5 or later is required
解决:yum install -y libcurl-devel
错误5:
configure: error: jpeglib.h not found
解决:yum install -y libjpeg-turbo-devel
错误6:
configure: error: png.h not found
解决:yum install -y libpng-devel
错误7:
configure: error: freetype-config not found.
解决: yum install -y freetype-devel
错误8:
configure: error: wrong mysql library version or lib not found
解决:下载一个低版本的MySQL/Mariadb
wget http://mirrors.163.com/mysql/Downloads/MySQL-5.6/mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
tar jxvf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.6.39-linux-glibc2.12-x86_64 /usr/local/mysql5.6
改编译参数
./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:
ERROR: [pool www] cannot get uid for user 'php-fpm'
解决: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
解压:
tar zxvf nginx-1.14.2.tar.gz
cd nginx-1.14.2
编译:
./configure --prefix=/usr/local/nginx --with-http_ssl_module
make && make install
启动:
/usr/local/nginx/sbin/nginx
- © 2019 GitHub, Inc.
代码:
[root@test01 ~]# cd /usr/local/src
[root@test01 src]# ls
mariadb-10.3.12-linux-x86_64.tar.gz
[root@test01 src]# wget http://cn2.php.net/distributions/php-7.3.1.tar.bz2
--2019-01-25 22:31:11-- http://cn2.php.net/distributions/php-7.3.1.tar.bz2
正在解析主机 cn2.php.net (cn2.php.net)... 36.51.255.144
正在连接 cn2.php.net (cn2.php.net)|36.51.255.144|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:14812823 (14M) [application/octet-stream]
正在保存至: “php-7.3.1.tar.bz2”
100%[===============================================>] 14,812,823 484KB/s 用时 52s
2019-01-25 22:32:04 (276 KB/s) - 已保存 “php-7.3.1.tar.bz2” [14812823/14812823])
[root@test01 src]# ls
mariadb-10.3.12-linux-x86_64.tar.gz php-7.3.1.tar.bz2
[root@test01 src]# ls
mariadb-10.3.12-linux-x86_64.tar.gz php-7.3.1.tar.bz2
[root@test01 src]# tar jxvf php-7.3.1.tar.bz2 提示没有安装bzip2
tar (child): bzip2:无法 exec: 没有那个文件或目录
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
[root@test01 src]# yum install -y bzip2 |less 安装一下
[root@test01 src]# tar jxf php-7.3.1.tar.bz2
[root@test01 src]# ls
mariadb-10.3.12-linux-x86_64.tar.gz php-7.3.1 php-7.3.1.tar.bz2
[root@test01 src]#
[root@test01 src]# cd php-7.3.1
[root@test01 php-7.3.1]# ls
acinclude.m4 ltmain.sh README.RELEASE_PROCESS
aclocal.m4 main README.SELF-CONTAINED-EXTENSIONS
appveyor makedist README.STREAMS
build Makefile.frag README.SUBMITTING_PATCH
buildconf Makefile.gcov README.TESTING
buildconf.bat Makefile.global README.UNIX-BUILD-SYSTEM
CODING_STANDARDS missing README.WIN32-BUILD-SYSTEM
config.guess mkinstalldirs run-tests.php
config.sub NEWS sapi
configure pear scripts
configure.ac php7.spec.in server-tests-config.php
CONTRIBUTING.md php.gif server-tests.php
CREDITS php.ini-development snapshot
ext php.ini-production stamp-h.in
EXTENSIONS README.EXT_SKEL tests
footer README.GIT-RULES travis
generated_lists README.input_filter TSRM
genfiles README.MAILINGLIST_RULES UPGRADING
header README.md UPGRADING.INTERNALS
INSTALL README.NEW-OUTPUT-API vcsclean
install-sh README.PARAMETER_PARSING_API win32
LICENSE README.REDIST.BINS Zend
[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
configure: WARNING: unrecognized options: --with-mysql, --with-mcrypt, --enable-gd-native-ttf
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for cc... no
checking for gcc... no
configure: error: in `/usr/local/src/php-7.3.1':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
错误1:缺少gcc这个包
[root@test01 php-7.3.1]#yum install -y gcc安装一下
错误2:缺少libxm12包
configure: error: libxml2 not found. Please check your libxml2 installation.
[root@test01 php-7.3.1]# yum list |grep libxml2 搜索一下
libxml2.x86_64 2.9.1-6.el7_2.3 @anaconda
libxml2-python.x86_64 2.9.1-6.el7_2.3 @base
libxml2.i686 2.9.1-6.el7_2.3 base
libxml2-devel.i686 2.9.1-6.el7_2.3 base
libxml2-devel.x86_64 2.9.1-6.el7_2.3 base
libxml2-static.i686 2.9.1-6.el7_2.3 base
libxml2-static.x86_64 2.9.1-6.el7_2.3 base
[root@test01 php-7.3.1]# echo $?
1
[root@test01 php-7.3.1]# yum install -y libxml2-devel 安装一下
错误3:缺少Openssl
configure: error: Cannot find OpenSSL's <evp.h>
[root@test01 php-7.3.1]# yum list |grep -i openssl grep匹配搜索-i忽略大小写
openssl.x86_64 1:1.0.1e-60.el7 @anaconda
openssl-libs.x86_64 1:1.0.1e-60.el7 @anaconda
apr-util-openssl.x86_64 1.5.2-6.el7 base
openssl.x86_64 1:1.0.2k-16.el7 base
openssl-devel.i686 1:1.0.2k-16.el7 base
openssl-devel.x86_64 1:1.0.2k-16.el7 base
openssl-libs.i686 1:1.0.2k-16.el7 base
openssl-libs.x86_64 1:1.0.2k-16.el7 base
openssl-perl.x86_64 1:1.0.2k-16.el7 base
openssl-static.i686 1:1.0.2k-16.el7 base
openssl-static.x86_64 1:1.0.2k-16.el7 base
openssl098e.i686 0.9.8e-29.el7.centos.3 base
openssl098e.x86_64 0.9.8e-29.el7.centos.3 base
perl-Crypt-OpenSSL-Bignum.x86_64 0.04-18.el7 base
perl-Crypt-OpenSSL-RSA.x86_64 0.28-7.el7 base
perl-Crypt-OpenSSL-Random.x86_64 0.04-21.el7 base
pyOpenSSL.x86_64 0.13.1-4.el7 base
pyOpenSSL-doc.noarch 0.13.1-4.el7 base
xmlsec1-openssl.i686 1.2.20-7.el7_4 base
xmlsec1-openssl.x86_64 1.2.20-7.el7_4 base
xmlsec1-openssl-devel.i686 1.2.20-7.el7_4 base
xmlsec1-openssl-devel.x86_64 1.2.20-7.el7_4 base
[root@test01 php-7.3.1]# yum install -y openssl-devel 安装一下
错误4: error: cURL version 7.15.5 or later is required to compile php with cURL support
[root@test01 php-7.3.1]# yum list |grep -i curl
curl.x86_64 7.29.0-51.el7 @base
libcurl.x86_64 7.29.0-51.el7 @base
python-pycurl.x86_64 7.19.0-19.el7 @anaconda
libcurl.i686 7.29.0-51.el7 base
libcurl-devel.i686 7.29.0-51.el7 base
libcurl-devel.x86_64 7.29.0-51.el7 base
perl-WWW-Curl.x86_64 4.15-13.el7 base
[root@test01 php-7.3.1]# yum install -y libcurl-devel 安装一下
错误5:error: jpeglib.h not found.
[root@test01 php-7.3.1]# yum list |grep -i jpeg
libjpeg-turbo.x86_64 1.2.90-5.el7 @anaconda
libjpeg-turbo.i686 1.2.90-6.el7 base
libjpeg-turbo.x86_64 1.2.90-6.el7 base
libjpeg-turbo-devel.i686 1.2.90-6.el7 base
libjpeg-turbo-devel.x86_64 1.2.90-6.el7 base
libjpeg-turbo-static.i686 1.2.90-6.el7 base
libjpeg-turbo-static.x86_64 1.2.90-6.el7 base
libjpeg-turbo-utils.x86_64 1.2.90-6.el7 base
openjpeg.x86_64 1.5.1-18.el7 base
openjpeg-devel.i686 1.5.1-18.el7 base
openjpeg-devel.x86_64 1.5.1-18.el7 base
openjpeg-libs.i686 1.5.1-18.el7 base
openjpeg-libs.x86_64 1.5.1-18.el7 base
turbojpeg.i686 1.2.90-6.el7 base
turbojpeg.x86_64 1.2.90-6.el7 base
turbojpeg-devel.i686 1.2.90-6.el7 base
turbojpeg-devel.x86_64 1.2.90-6.el7 base
[root@test01 php-7.3.1]# yum install -y libjpeg-turbo-devel
错误6:error: png.h not found.
[root@test01 php-7.3.1]# yum list |grep png
libpng.x86_64 2:1.5.13-7.el7_2 @anaconda
libpng.i686 2:1.5.13-7.el7_2 base
libpng-devel.i686 2:1.5.13-7.el7_2 base
libpng-devel.x86_64 2:1.5.13-7.el7_2 base
libpng-static.i686 2:1.5.13-7.el7_2 base
libpng-static.x86_64 2:1.5.13-7.el7_2 base
libpng12.i686 1.2.50-10.el7 base
libpng12.x86_64 1.2.50-10.el7 base
libpng12-devel.i686 1.2.50-10.el7 base
libpng12-devel.x86_64 1.2.50-10.el7 base
optipng.x86_64 0.7.4-4.el7 base
pngcrush.x86_64 1.7.59-4.el7 base
pngnq.x86_64 1.1-9.el7 base
texlive-dvipng.noarch 2:svn26689.1.14-43.el7 base
texlive-dvipng-bin.x86_64 2:svn26509.0-43.20130427_r30134.el7
texlive-dvipng-doc.noarch 2:svn26689.1.14-43.el7 base
[root@test01 php-7.3.1]# yum list |grep png|grep devel 可以连续grep匹配多次
libpng-devel.i686 2:1.5.13-7.el7_2 base
libpng-devel.x86_64 2:1.5.13-7.el7_2 base
libpng12-devel.i686 1.2.50-10.el7 base
libpng12-devel.x86_64 1.2.50-10.el7 base
[root@test01 php-7.3.1]# yum install -y libpng-devel
错误7:error: freetype-config not found.
,
[root@test01 php-7.3.1]# yum list |grep freetype
freetype.x86_64 2.4.11-12.el7 @anaconda
freetype.i686 2.8-12.el7 base
freetype.x86_64 2.8-12.el7 base
freetype-demos.x86_64 2.8-12.el7 base
freetype-devel.i686 2.8-12.el7 base
freetype-devel.x86_64 2.8-12.el7 base
[root@test01 php-7.3.1]# yum install -y freetype-devel
错误8:error: wrong mysql library version or lib not found. Check config.log for more information. 提示mysql版本不匹配
下载一个低版本的mysql/mariadb
也可以去掉编译中的--with-mysql=/usr/local/mysql 结果这个方法没用
[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
[root@test01 src]# tar zxf mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz 解压不加v不显示过程
[root@test01 src]# mv mysql-5.7.23-linux-glibc2.12-x86_64 /usr/local/mysql5.7
[root@test01 php-7.3.1]# cd 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/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
改mysql的路径改成5.7
configure: WARNING: unrecognized options: --with-mysql, --with-mcrypt, --enable-gd-native-ttf
[root@test01 php-7.3.1]# echo $?
0
[root@test01 php-7.3.1]# make 把源码包变成二进制包
[root@test01 php-7.3.1]# echo $?
0
[root@test01 php-7.3.1]# make install
[root@test01 php-7.3.1]# echo $?
0
如果要卸载的话。rm -rvf /usr/local/php-fpm/卸载掉,用history可以查看装了多少rpm包,也可以卸载掉这些安装的rpm包,但其实影响不大,不用去remove也没关系
[root@test01 php-7.3.1]# ls /usr/local/php-fpm/
bin etc include lib php sbin var
[root@test01 php-7.3.1]# cd !$
cd /usr/local/php-fpm/
[root@test01 php-7.3.1]# ls
bin etc include lib php sbin var
[root@test01 php-fpm]# cd etc/
[root@test01 etc]# ls
pear.conf php-fpm.conf.default php-fpm.d
[root@test01 etc]# cp php-fpm.conf.default php-fpm.conf 拷贝生成模板配置文件,不然Php没办法启动
[root@test01 etc]# ls
pear.conf php-fpm.conf php-fpm.conf.default php-fpm.d
[root@test01 etc]# cd /usr/local/src/php-7.3.1
[root@test01 php-7.3.1]# ls
acinclude.m4 libtool README.NEW-OUTPUT-API
aclocal.m4 LICENSE README.PARAMETER_PARSING_API
appveyor ltmain.sh README.REDIST.BINS
build main README.RELEASE_PROCESS
buildconf makedist README.SELF-CONTAINED-EXTENSIONS
buildconf.bat Makefile README.STREAMS
CODING_STANDARDS Makefile.frag README.SUBMITTING_PATCH
config.guess Makefile.fragments README.TESTING
config.log Makefile.gcov README.UNIX-BUILD-SYSTEM
config.nice Makefile.global README.WIN32-BUILD-SYSTEM
config.status Makefile.objects run-tests.php
config.sub missing sapi
configure mkinstalldirs scripts
configure.ac modules server-tests-config.php
CONTRIBUTING.md NEWS server-tests.php
CREDITS pear snapshot
ext php7.spec stamp-h.in
EXTENSIONS php7.spec.in tests
footer php.gif travis
generated_lists php.ini-development TSRM
genfiles php.ini-production UPGRADING
header README.EXT_SKEL UPGRADING.INTERNALS
include README.GIT-RULES vcsclean
INSTALL README.input_filter win32
install-sh README.MAILINGLIST_RULES Zend
libs README.md
[root@test01 php-7.3.1]# diff php.ini-development php.ini-production (左)测试及开发用配置文件,(右)生产用配置文件。比较两个配置文件有哪些地方有不同
86c86
< ; This is the php.ini-development INI file.
---
> ; This is the php.ini-production INI file.
155a156,160
> ; track_errors
> ; Default Value: Off
> ; Development Value: On
> ; Production Value: Off
>
455c460
< error_reporting = E_ALL
---
> error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
472c477
< display_errors = On
---
> display_errors = Off
483c488
< display_startup_errors = On
---
> display_startup_errors = Off
520c525,527
< ; Store the last error/warning message in $php_errormsg (boolean).
---
> ; Store the last error/warning message in $php_errormsg (boolean). Setting this value
> ; to On can assist in debugging and is appropriate for development servers. It should
> ; however be disabled on production servers.
1201c1208
< mysqlnd.collect_memory_statistics = On
---
> mysqlnd.collect_memory_statistics = Off
1580c1587
< zend.assertions = 1
---
> zend.assertions = -1
1886c1893
< ;opcache.huge_code_pages=0
---
> ;opcache.huge_code_pages=1
[root@test01 php-7.3.1]# cp php.ini-development /usr/local/php-fpm/etc/php.ini把另一个模板配置文件拷贝到/usr/local/php-fpm/etc/下。一共两个配置文件,一个是服务本身的配置文件,一个是php的配置文件
[root@test01 php-7.3.1]#
[root@test01 php-7.3.1]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm 拷贝启动脚本
[root@test01 php-7.3.1]# chkconfig --add php-fpm
[root@test01 php-7.3.1]# chkconfig --list
注意:该输出结果只显示 SysV 服务,并不包含原生 systemd 服务。SysV 配置数据可能被原生 systemd 配置覆盖。
如果您想列出 systemd 服务,请执行 'systemctl list-unit-files'。
欲查看对特定 target 启用的服务请执行
'systemctl list-dependencies [target]'。
mysqld 0:关 1:关 2:开 3:开 4:开 5:开 6:关
netconsole 0:关 1:关 2:关 3:关 4:关 5:关 6:关
network 0:关 1:关 2:开 3:开 4:开 5:开 6:关
php-fpm 0:关 1:关 2:开 3:开 4:开 5:开 6:关
[root@test01 php-7.3.1]# chkconfig php-fpm on
[root@test01 php-7.3.1]# chkconfig --list
注意:该输出结果只显示 SysV 服务,并不包含原生 systemd 服务。SysV 配置数据可能被原生 systemd 配置覆盖。
如果您想列出 systemd 服务,请执行 'systemctl list-unit-files'。
欲查看对特定 target 启用的服务请执行
'systemctl list-dependencies [target]'。
mysqld 0:关 1:关 2:开 3:开 4:开 5:开 6:关
netconsole 0:关 1:关 2:关 3:关 4:关 5:关 6:关
network 0:关 1:关 2:开 3:开 4:开 5:开 6:关
php-fpm 0:关 1:关 2:开 3:开 4:开 5:开 6:关
[root@test01 php-7.3.1]# service php-fpm start
Unit php-fpm.service could not be found.
env: /etc/init.d/php-fpm: 权限不够
[root@test01 php-7.3.1]# chmod 755 /etc/init.d/php-fpm
[root@test01 php-7.3.1]# service php-fpm start
Unit php-fpm.service could not be found.
Starting 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.
[26-Jan-2019 01:15:26] ERROR: No pool defined. at least one pool section must be specified in config file
[26-Jan-2019 01:15:26] ERROR: failed to post process the configuration
[26-Jan-2019 01:15:26] ERROR: FPM initialization failed
failed 定义配置池子
[root@test01 php-7.3.1]# vi /usr/local/php-fpm/etc/php-fpm.conf 定位到143行
[1]+ 已停止 vi /usr/local/php-fpm/etc/php-fpm.conf
[root@test01 php-7.3.1]# cd /usr/local/php-fpm/etc/php-fpm.d/
[root@test01 php-fpm.d]# ls
www.conf.default
[root@test01 php-fpm.d]# cp www.conf.default www.conf
[root@test01 php-fpm.d]# ls
www.conf www.conf.default
[root@test01 php-fpm.d]# service php-fpm start
Unit php-fpm.service could not be found.
Starting php-fpm [26-Jan-2019 01:23:36] ERROR: [pool www] cannot get uid for user 'php-fpm'
[26-Jan-2019 01:23:36] ERROR: FPM initialization failed
failed 没有php-fpm这个用户
[root@test01 php-fpm.d]# useradd php-fpm
[root@test01 php-fpm.d]# service php-fpm start
Unit php-fpm.service could not be found.
Starting php-fpm done
[root@test01 php-fpm.d]# ps aux |grep php-fpm
root 52445 0.0 0.1 126348 1704 pts/1 T 01:17 0:00 vi /usr/local/php-fpm/etc/php-fpm.conf
root 52482 0.0 0.6 127148 6196 ? Ss 01:26 0:00 php-fpm: master process (/usr/local/php-fpm/etc/php-fpm.conf)
php-fpm 52483 0.0 0.6 127148 6104 ? S 01:26 0:00 php-fpm: pool www
php-fpm 52484 0.0 0.6 127148 6104 ? S 01:26 0:00 php-fpm: pool www
root 52487 0.0 0.0 112728 980 pts/1 R+ 01:27 0:00 grep --color=auto php-fpm
[root@test01 php-fpm.d]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 973/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1253/master
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 52482/php-fpm: mast
tcp6 0 0 :::3306 :::* LISTEN 3244/mysqld
tcp6 0 0 :::22 :::* LISTEN 973/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1253/master
编译安装nginx
[root@test01 php-fpm.d]# cd /usr/local/src/
[root@test01 src]# ls
mariadb-10.3.12-linux-x86_64.tar.gz php-7.3.1
mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz php-7.3.1.tar.bz2
[root@test01 src]# wget http://120.52.51.15/nginx.org/download/nginx-1.14.2.tar.gz
--2019-01-26 01:32:39-- http://120.52.51.15/nginx.org/download/nginx-1.14.2.tar.gz
正在连接 120.52.51.15:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1015384 (992K) [application/octet-stream]
正在保存至: “nginx-1.14.2.tar.gz”
100%[===============================================>] 1,015,384 536KB/s 用时 1.8s
2019-01-26 01:32:41 (536 KB/s) - 已保存 “nginx-1.14.2.tar.gz” [1015384/1015384])
[root@test01 src]# tar zxf nginx-1.14.2.tar.gz
[root@test01 src]# cd nginx-1.14.2
[root@test01 nginx-1.14.2]# ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src
[root@test01 nginx-1.14.2]#
[root@test01 nginx-1.14.2]# ./configure --prefix=/usr/local/nginx --with-http_ssl_module
[root@test01 nginx-1.14.2]# echo $?
0
[root@test01 nginx-1.14.2]# make && install 意思是前面的命令成功才会运行后面的命令,如果不成功不运行。
[root@test01 nginx-1.14.2]# echo $?
0
[root@test01 conf]# /usr/local/nginx/sbin/nginx 启动nginx 没有启动脚本不太好管理
[root@test01 conf]# ps aux |grep nginx
root 55077 0.0 0.1 45844 1128 ? Ss 01:46 0:00 nginx: master process /usr/local/nginx/sbin/nginx
nobody 55078 0.0 0.1 46292 1896 ? S 01:46 0:00 nginx: worker process
root 55080 0.0 0.0 112728 980 pts/1 R+ 01:46 0:00 grep --color=auto ngin
[root@test01 conf]# netstat -ltnp |grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 55077/nginx: master
[root@test01 conf]# /usr/local/nginx/sbin/nginx 配置文件路径
[root@test01 conf]# vi nginx.conf