Ubuntu 非手动编译安装 PHP8 和 Nginx
2022-06-24 本文已影响0人
孙庚辛
sudo apt install nginx
sudo add-apt-repository ppa:ondrej/nginx
sudo apt update
sudo apt upgrade
sudo apt-get install php
sudo apt-get install php-fpm
查看安装后的状态,
sudo systemctl status php8.1-fpm
里面有个版本号根据实际情况替换一下。
编辑这个文件 /etc/nginx/sites-available/default
server {
...
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
}
...
}
在 server 中添加上面的内容来支持 php , 其中 php 版本号需要替换 。
验证一下是否语法正确。
sudo nginx -t
重启 nginx 就可以了
sudo systemctl restart nginx