1.CentOS 7使用yum安装PHP5.6
1.1 删除旧php包
yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64
1.2 配置epel源
yum install -y epel-release
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
1.3 配置remi源
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
1.4 安装php5.6.x
yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof
1.5 安装php-fpm
yum install --enablerepo=remi --enablerepo=remi-php56 php-fpm
1.6 配置开机启动服务
systemctl restart php-fpm
systemctl enable php-frm (error)
1.7 查看是否安装成功
ps -ef | grep php
netstat -anp | grep 9000
2. 配置php vi /etc/php.ini
always_populate_raw_post_data = -1
cgi.fix_pathinfo = 0 #如果文件不存在,则阻止 Nginx 将请求发送到后端的 PHP-FPM 模块, 以避免遭受恶意脚本注入的攻击
3. 配置php-fpm
3.1 创建用户matomo
groupadd matomo
useradd -g matomo matomo
3.2 vi /etc/php-fpm.d/www.conf
user = matomo
group = matomo
listen = 127.0.0.1:9001
3.3 重启php-fpm
systemctl restart php-fpm
4.部署nginx
4.1 源码编译
./configure --prefix=/data/home/user00/app/nginx \
--conf-path=/data/home/user00/app/nginx/nginx.conf \
--pid-path=/data/home/user00/app/nginx/nginx.pid \
--with-pcre \
--with-openssl=/usr/bin/openssl
4.2 make & make install
4.3 配置对php的支持 vi nginx.conf
server/location/index,增加index.php
同时,修改如下部分
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
5. 部署matomo
5.1 将最新的matomo解压到nginx/html
chown matomo:matomo matomo
5.2 重启
sbin/nginx -s stop
sbin/nginx