php编译和配置:
1、 ./configure --prefix=/opt/php5 --enable-fpm
然后sudo make && sudo make install
2、进入php5安装后的目录etc文件夹执行 cp php-fpm.conf.default php-fpm.conf
3、将安装文件的php.ini复制到/opt/php5/lib/文件夹里。
nginx配置:
0、nginx在库里就有,直接安装 sudo apt install nginx
1、修改增加 index.php默认主页
2、修改 /etc/nginx/sites-enabled/default 文件以下地方:
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
#fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; //这里不能打开
# # With php-cgi (or other tcp sockets):
fastcgi_pass 127.0.0.1:9000;
}
3、ln -s /opt/php5/sbin/php-fpm /usr/local/sbin/php-fpm
4、启动nginx和php:
sudo nginx -s reload
sudo nginx -s reopen
sudo php-fpm