在Debian 8系统安装 nginx + php + mysql(MariaDB) 基本Web环境

阿里云的ECS公共系统镜像里有“Debian 8.0 64位”的选择项,下边以安装wordpress为例,简单记录一下安装环境的过程。

环境:Debian 8 64位, nginx-1.6.2,php-5.6,MariaDB-10.0

过程:

1.创建文件 /etc/apt/sources.list,因为当前Debian 8的镜像系统中没有该文件,内容如下:

deb http://httpredir.debian.org/debian jessie main contrib non-free
deb-src http://httpredir.debian.org/debian jessie main contrib non-free
deb http://httpredir.debian.org/debian jessie-updates main contrib non-free
deb-src http://httpredir.debian.org/debian jessie-updates main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free

2.运行 apt-get update 的命令,更新软件包安装源

3.运行 apt-get install nginx 命令,安装 nginx web

4.运行 apt-get install php5-fpm php5-mysqlnd 命令,安装 php-fpm 及相应组件

5.编辑默认的nginx站点配置文件/etc/nginx/sites-enabled/default,添加 index.php 类型的默认首页文件,及启用php

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

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
        #
        #       # With php5-cgi alone:
        #       fastcgi_pass 127.0.0.1:9000;
        #       # With php5-fpm:
                fastcgi_pass unix:/var/run/php5-fpm.sock;
        }
 

6.之后需要通过 systemctl restart nginx 命令重启 nginx 服务,以让更改生效

7.运行 apt-get install mariadb-server 命令,安装 MariaDB (mysql)数据库服务端

8.将wordpress的程序文件放在 /var/www/html 目录里,根据提示完成wordpress安装
bbs-aliyun-dongshan3-288162-1.png

参考:
https://wiki.debian.org/SourcesList
https://www.vultr.com/docs/setup-up-nginx-php-fpm-and-mariadb-on-debian-8

标签: none

添加新评论