首先更新源
apt-get update;
安装nginx
Ubuntu16.04有Nginx安装包,我们可以直接安装。

打开服务

然后在浏览器输入IP地址,出现以下页面,代表安装成功

安装php7

配置nginx
打开配置文件,改为如下,

# # With php7.0-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# # With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
重启服务

修改php配置

然后设置cgi.fix_pathinfo=0:extension=php_mysqli.dll打开
安装php_mysqli拓展

重新加载php

在/var/www/html建立测试文件phpinfo.php
<?php
phpinfo();
?>
浏览器访问该文件,出现以下页面,配置成功

网友评论