PHP Nginx安装

安装相关php依赖库

apt install libxml2-dev
#安装gcc
apt install build-essential -y
apt install libssl-dev  -y
apt install libcurl4-gnutls-dev -y
apt install libjpeg-dev -y
apt install libpng-dev -y
apt install libmcrypt-dev -y
apt install libfreetype6-dev -y
apt install libreadline6 libreadline6-dev -y

PHP默认会启用以下模块
Core
ctype
date
dom
fileinfo
filter
hash
iconv
json
libxml
pcre
PDO
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter

PHP安装配置

./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7/etc --enable-fpm --enable-mysqlnd --enable-exif --enable-intl --enable-mbstring --enable-shmop --enable-soap --enable-sockets --enable-ftp --enable-pcntl --enable-zip --with-pdo-mysql --with-gd --with-zlib --with-curl --with-mcrypt --with-openssl --with-mysqli --with-freetype-dir --enable-gd-native-ttf

php内置web server服务
/usr/local/php7/bin/php -S 0.0.0.0:80
/usr/local/php7/sbin/php-fpm

Nginx 安装参数

Nginx需要依赖下面3个包

  1. gzip 模块需要 zlib 库 ( 下载: http://www.zlib.net/ ) zlib-1.2.8.tar.gz

--> apt install zlib1g-dev -y

  1. rewrite 模块需要 pcre 库 ( 下载: http://www.pcre.org/ ) pcre-8.21.tar.gz

--> apt install libpcre3-dev -y

  1. ssl 功能需要 openssl 库 ( 下载: http://www.openssl.org/ ) openssl-1.0.1.tar.gz

--> apt install libssl-dev -y

Nginx 安装配置

./configure --prefix=/usr/local/Nginx --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-pcre --with-http_v2_module --with-http_sub_module

./configure 默认位置

配置摘要
?? +使用系统PCRE库
?? + OpenSSL库未被使用
?? +使用系统zlib库

?? nginx路径前缀:“/ usr / local / nginx”
?? nginx二进制文件:“/ usr / local / nginx / sbin / nginx”
?? nginx模块路径:“/ usr / local / nginx / modules”
?? nginx配置前缀:“/ usr / local / nginx / conf”
?? nginx配置文件:“/usr/local/nginx/conf/nginx.conf”
?? nginx pid文件:“/usr/local/nginx/logs/nginx.pid”
?? nginx错误日志文件:“/usr/local/nginx/logs/error.log”
?? nginx http访问日志文件:“/usr/local/nginx/logs/access.log”
?? nginx http客户端请求体临时文件:“client_body_temp”
?? nginx http代理临时文件:“proxy_temp”
?? nginx http fastcgi临时文件:“fastcgi_temp”
?? nginx http uwsgi临时文件:“uwsgi_temp”
?? nginx http scgi临时文件:“scgi_temp”