alias別名php
php編譯安裝html
編譯安裝Nginxpython
Alias別名:mysql
一條命令的另一個名字,你能夠理解爲外號。 舉例: 網卡配置文件路徑很長,每次敲這個命令都要花很長時間,能夠作一個別名: alias viens33='vi /etc/sysconfig/network-scripts/ifcfg-ens33(例子)' #只對當前窗口生效,全部就衍生下面2條永久生效的命令 vi ~/.bashrc //針對當前用戶的,換一個用戶就很差使了 vi /etc/bashrc //針對全部用戶生效,不單單是當前用戶。 在這個文件最後面增長如:alias viens33='vi /etc/sysconfig/network-scripts/ifcfg-ens33' 以後還得編譯他 Source /etc/bash...
root的當前目錄下有.bashrclinux
下載PHPnginx
cd /usr/local/src wget http://cn2.php.net/distributions/php-7.3.0.tar.bz2
解壓sql
tar jxvf php-7.3.0.tar.bz2
編譯centos
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
配置文件:api
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
啓動腳本:bash
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
php實驗中的調試錯誤 :
解決方法:把5.6的包換成了一個5.7的MySQL二進制包 放入/usr/local/mysql5.7
PHP和nginx安裝代碼:
[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(啓動以前記得make&&make install) 沒有啓動腳本不太好管理 [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