Ubuntu 22.04.4 LTS 安装 php apache LAMP 环境nginx

1 安装php-fpm

apt update
apt-get install php-fpm

#配置php-fpm服务启动
systemctl  enable  php8.1-fpm
systemctl  start  php8.1-fpm
#查看服务
systemctl  status  php8.1-fpm
#查看版本
root@iZbp1g7fmjea77vsqc5hmmZ:~# php  -v
PHP 8.1.2-1ubuntu2.18 (cli) (built: Jun 14 2024 15:52:55) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2-1ubuntu2.18, Copyright (c), by Zend Technologies

2 nginx 安装

sudo apt update
sudo apt-get  install  nginx
#配置nginx服务启动
sudo systemctl restart nginx
sudo systemctl enable nginx

3  配置nginx

vim  /etc/nginx/sites-available/default

root /data/www/html;
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php8.1-fpm.sock;

        }

4 测试文件

#vim /data/www/html/index.php
<?php
phpinfo();
?>

5 访问测试页面

相关推荐

  1. Ubuntu2204安装小熊猫C++/DevCpp

    2024-07-11 21:32:02       72 阅读
  2. ubuntu2204,mysql8.x安装

    2024-07-11 21:32:02       54 阅读
  3. Ubuntu 编译安装 nginx

    2024-07-11 21:32:02       41 阅读
  4. ubantu安装nginx

    2024-07-11 21:32:02       31 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-11 21:32:02       66 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-11 21:32:02       70 阅读
  3. 在Django里面运行非项目文件

    2024-07-11 21:32:02       57 阅读
  4. Python语言-面向对象

    2024-07-11 21:32:02       68 阅读

热门阅读

  1. 常用的简单的ps快捷键

    2024-07-11 21:32:02       19 阅读
  2. Bug汇总

    2024-07-11 21:32:02       20 阅读
  3. LVS集群(二)

    2024-07-11 21:32:02       22 阅读
  4. vscode连接unbuntu失败,显示Downloading vs code server...

    2024-07-11 21:32:02       19 阅读
  5. Memcached介绍和详解

    2024-07-11 21:32:02       20 阅读
  6. Qt常用基础控件总结—表格控件(QTableWidget类)

    2024-07-11 21:32:02       22 阅读
  7. pudb: Python的图形化调试器

    2024-07-11 21:32:02       24 阅读
  8. 派森学长带你学python—字符串

    2024-07-11 21:32:02       20 阅读
  9. DP学习——设计模式怎么来的?

    2024-07-11 21:32:02       17 阅读
  10. 7.10飞书一面

    2024-07-11 21:32:02       17 阅读
  11. wpf 不同 DataContext 之间的通讯

    2024-07-11 21:32:02       21 阅读
  12. 状态同步和帧同步原理细节

    2024-07-11 21:32:02       22 阅读
  13. easy-poi实现动态列(标题)、多sheet导出excel

    2024-07-11 21:32:02       23 阅读