标签归档:yum

centos 7 + php 7 + nginx + wordpress之yum最简单安装办法

安装eple库

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

安装webtatic库

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

更新yum源

yum update

安装php7以及扩展

yum install php71w-gd php71w-pdo php71w-opcache php71w-fpm php71w-pecl-redis php71w-mysql php71w-mcrypt php71w-mbstring php71w-intl php71w-cli

安装nginx

yum install nginx1w -y

系统启动时自动启动nginx以及php-fpm

systemctl enable nginx php-fpm
systemctl start nginx php-fpm

修改php程序目录权限

chown -R apache:apache /data/web/www.c4ys.com/

修改ngingx配置(以为wordpress例)

vim /etc/nginx/conf.d/www.c4ys.com.conf

server {
    server_name  www.c4ys.com c4ys.com;
    root   /data/phpproject/www.c4ys.com;
    location / {
        index  index.html index.php;
        try_files $uri $uri/ /index.php?$args;
    }
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        include        fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

给fastestmirror再提速

fedora和centos安装了fastermirror之后会快一些,但是还是经常选到国外的站点。

方法1:修改源配置文件(推荐,以fedora20为例)

sudo vim fedora.repo
# 找到以下这行
metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch
# 后面添加&country=cn
metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch&country=cn
sudo vim fedora-updates.repo
# 找到以下这行
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch
# 后面添加&country=cn
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch&country=cn

方法2:修改fastestmirror.conf

sudo vim /etc/yum/pluginconf.d/fastestmirror.conf

修改后清除fastestmirror和metalink缓存

sudo yum clean metadata plugins
sudo yum -y update