在docker里部署了很多网络服务,有些就自带有php支持,例如typecho,easyimage等,这里在主机上直接安装。
安装nginx
apt install nginx
nginx缺省网络地址是/var/www/html。
安装php
apt install php-fpm
安装的时候会发现安装的是php8.2。
复制php文件到/var/www/html。
修改nginx设置
编辑/etc/nginx/sites-enabled/default文件,开启php支持。
nano -c /etc/nginx/sites-enabled/default
在缺省文件处添加index.php,在随后删掉php支持语句前面的注释符号#。
见图中加红框处。
nginx -t
#测试配置是否正确,出错会有提示。
systemctl restart nginx
#重启nginx服务。