美文网首页
Ubuntu 非手动编译安装 PHP8 和 Nginx

Ubuntu 非手动编译安装 PHP8 和 Nginx

作者: 孙庚辛 | 来源:发表于2022-06-24 22:06 被阅读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

相关文章

网友评论

      本文标题:Ubuntu 非手动编译安装 PHP8 和 Nginx

      本文链接:https://www.haomeiwen.com/subject/jyybvrtx.html