一、安装Nginx
sudo apt-get update
sudo apt-get install nginx
nginx -v查看版本
二、安装php7.0
sudo apt-get update
sudo apt-get install php7.0
php -v查看版本
三、nginx适配php
修改/etc/nginx/sites-available/default如下:
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;
}
四、改好后保存退出,重启服务:
sudo service php7.0-fpm restart
sudo service nginx restart