Centos7中部署Nextcloud
注:此文章仅作为笔记参考
环境:
centos7
nginx
php7.2
nextcloud
mariadb
安装nginx和php-fpm
添加EPEL源然后安装nginx:
$ yum install epel-release -y
$ yum install nginx -y
安装php-fpm和nextcloud的一些依赖
$ rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ rpm -ivh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
$ yum install epel-release unzip curl wget -y
$ yum install php72w-fpm php72w-pecl-apcu-devel php72w-json \
php72w-pecl-apcu php72w-gd php72w-mcrypt php72w-cli php72w-pear \
php72w-xml php72w-mbstring php72w-pdo php72w php72w-cli \
php72w-common php72w-curl php72w-gd php72w-mbstring php72w-mysqlnd \
php72w-process php72w-xml php72w-zip php72w-opcache php72w-pecl-apcu \
php72w-intl php72w-pecl-redis php72w-pecl-imagick -y
检查一下php是否安装成功和查看版本
$ php -v
PHP 7.2.22 (cli) (built: Sep 11 2019 18:11:52) ( NTS )
Copyright © 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright © 1998-2018 Zend Technologies
配置php-fpm
编辑文件
$ vi /etc/php-fpm.d/www.conf
找到user和group这两行,修改为如下:
user = nginx
group = nginx
再找到下面这行,并确认为如下:
listen = 127.0.0.1:9000
然后再取消下面几行的注释,去掉前面的;即可:
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
保存并退出
创建一个新的目录并将权限给nginx:
$ mkdir -p /var/lib/php/session
$ chown nginx:nginx -R /var/lib/php/session/
开启nginx服务和php-fpm:
$ systemctl start nginx
$ systemctl enable nginx
$ systemctl start php-fpm
$ systemctl enable php-fpm
安装和配置mariadb
安装mariadb
$ yum install mariadb mariadb-server python2-PyMySQL -y
创建并编辑 /etc/my.cnf.d/nextcloud.cnf,或者直接编辑 /etc/my.cnf ,然后完成如下动作:
在[mysqld]
部分,设置如下键值来启用一起有用的选项和 UTF-8 字符集:
[mysqld]
<