nginx安装步骤

1、下载 libxml2

wget ftp://xmlsoft.org/libxml2/libxml2-git-snapshot.tar.gz
wget ftp://xmlsoft.org/libxml2/libxml2-2.9.9.tar.gz
nginx安装步骤_第1张图片

解压安装libxml2

tar -zxvf libxml2-git-snapshot.tar.gz

yum install python python-devel

apt install python python-dev

./configure --prefix=/usr/local/libxml2
make
make install

################################################
2\ 下载 zlib

wget http://www.zlib.net/zlib-1.2.11.tar.gz

tar -zxvf zlib-1.2.11.tar.gz

./configure --prefix=/usr/local/zlib

make
make install

################################################
3、yum install autoconf

################################################

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-libxml-dir=/usr/local/libxml2 --with-zlib-dir=/usr/local/zlib/ --with-mysqli --enable-soap --enable-mbstring=all --enable-sockets --enable-pdo --enable-fpm

make

make install

####################################3
启动php-fpm

1、跳转php的安装路径
cd /usr/local/php
cd etc 跳转配置文件目录

2、重命名 php-fpm.conf文件

mv ./php-fpm.conf.default php-fpm.conf

3\复制phpini到php安装路径下边
cp /home/likang/php-7.3.10/php.ini-development /usr/local/php/etc/php.ini

4。配置php-fpm进程
cd /usr/local/php/etc/php-fpm.d/

mv www.conf.default www.conf

5、启动

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

#################################

nginx和php进行交互

找到nginx的配置文件
去掉注释

location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME d o c u m e n t r o o t document_root documentrootfastcgi_script_name;
include fastcgi_params;
}

重启nginx

/usr/local/nginx/sbin/nginx -s reload

添加一个php文件
vim 1901.php

你可能感兴趣的:(nginx)