在Debian 8系统里安装nginx + php7.0-fpm + MariaDB

环境:Debian 8.8 64位,阿里云公共系统镜像,ECS实例配置:1核2GB内存,经典网络

过程:

  1. vi /etc/apt/sources.list 编辑安装源,添加 dotdeb 镜像站点信息,

    deb http://mirror.xtom.com.hk/dotdeb/ jessie all
    deb-src http://mirror.xtom.com.hk/dotdeb/ jessie all

  2. 添加 GnuPG key

    wget https://www.dotdeb.org/dotdeb.gpg
    apt-key add dotdeb.gpg

  3. apt-get update 更新
  4. apt-get install nginx 安装nginx
  5. apt-get install php7.0-fpm php7.0-gd php7.0-mysql php7.0-mbstring 安装php7.0及相关组件
  6. 编辑默认的nginx站点配置文件/etc/nginx/sites-enabled/default,添加 index.php 类型的默认首页文件,及启用php

    index index.html index.php index.htm index.nginx-debian.html;

    location ~ .php$ {

             include snippets/fastcgi-php.conf;
             fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
     }
    
  7. systemctl restart nginx 重启 nginx 服务,以让更改生效
  8. apt-get install mariadb-server ,安装 MariaDB (mysql)数据库服务端
  9. 上传一个phpmyadmin测试,正常

参考:

  1. https://www.dotdeb.org/instructions/
  2. https://www.cyberciti.biz/faq/installing-php-7-on-debian-linux-8-jessie-wheezy-using-apt-get/

标签: php7.0

添加新评论