Ubuntu Nginx中启用php支持

备份文件
  • cd /etc/nginx/sites-avaiable/ && sudo cp default default.old
修改文件
  • sudo vi default
添加以下内容:
root /var/www/html;
index index.html index.php index.htm;
location ~ \.php$ {
    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}
重启nginx
  • sudo systemctl restart nginx

你可能感兴趣的:(学习笔记)