Ubuntu16.04搭建LNMP
1.进行更新 (具体文档请联系本博主,首页有博主邮箱)
2.安装MySQL
# 连续输入两次相同的密码
3.安装nginx和php
添加nginx和php的ppa源
4.安装Nginx
5.安装PHPFastCGI管理器
6.修改配置文件(此步可以省略)
7.查看 listen = /run/php/php7.0-fpm.sock 是否被开启
一般为开启
8.修改重启下 php-fpm7.0 (可以忽略)
9.修改nginx配置文件
sudo vim /etc/nginx/sites-enabled/default
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html; 添加index.php
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ { 在此把#去掉
include snippets/fastcgi-php.conf; 在此把#去掉
#
# # 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; 在此把#去掉
} 在此把#去掉
10.socket 方式 必须和上面socket的listen路径一样
11.重启nginx
12.在/var/www/html/目录下,新建个index.php测试下看看
13.搭建完成 探针显示
PHP Version 7.0.18-0ubuntu0.16.04.1