kindquiet素食勤俭敬老孝慈

WordPress 4.x 后台打开慢,显示加载fonts.googleapis.com

解决方法有替换open sans 字体的加载源,把字体禁止或换成本地。

推荐方法:
替换open sans 字体的加载源,在当前主题中加入下面的代码:
?php
/
Plugin Name: DW Replace Open Sans
Plugin URI: http://devework.com/replace-open-sans.html
Description: 将WordPress 后台中的open-sans字体加载源从Google Fonts替换为360的CDN加载源。
Author: Jeff
Author URI: http://devework.com/
Version: 1.0
Text Domain: dw-replace-open-sans
/

function devework_replace_open_sans() {
wp_deregister_style(‘open-sans’);
wp_register_style( ‘open-sans’, ‘//fonts.useso.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600’ );
wp_enqueue_style( ‘open-sans’);
}
add_action( ‘wp_enqueue_scripts’, ‘devework_replace_open_sans’ );
add_action(‘admin_enqueue_scripts’, ‘devework_replace_open_sans’);
其它方法一:本地替换教程
新建google-font.css 放在\wp-includes\css目录中(附该css文件的内容如下)

——————代码区begin————————
@font-face {
font-family: ‘Open Sans’;
font-style: normal;
font-weight: 300;
src: local(‘Open Sans Light’), local(‘OpenSans-Light’), url(../fonts/google/DXI1ORHCpsQm3Vp6mXoaTRa1RVmPjeKy21_GQJaLlJI.woff) format(‘woff’);
}
@font-face {
font-family: ‘Open Sans’;
font-style: normal;
font-weight: 400;
src: local(‘Open Sans’), local(‘OpenSans’), url(../fonts/google/u-WUoqrET9fUeobQW7jkRT8E0i7KZn-EPnyo3HZu7kw.woff) format(‘woff’);
}
@font-face {
font-family: ‘Open Sans’;
font-style: normal;
font-weight: 600;
src: local(‘Open Sans Semibold’), local(‘OpenSans-Semibold’), url(../fonts/google/MTP_ySUJH_bn48VBG8sNSha1RVmPjeKy21_GQJaLlJI.woff) format(‘woff’);
}
@font-face {
font-family: ‘Open Sans’;
font-style: italic;
font-weight: 300;
src: local(‘Open Sans Light Italic’), local(‘OpenSansLight-Italic’), url(../fonts/google/PRmiXeptR36kaC0GEAetxrsuoFAk0leveMLeqYtnfAY.woff) format(‘woff’);
}
@font-face {
font-family: ‘Open Sans’;
font-style: italic;
font-weight: 400;
src: local(‘Open Sans Italic’), local(‘OpenSans-Italic’), url(../fonts/google/xjAJXh38I15wypJXxuGMBtIh4imgI8P11RFo6YPCPC0.woff) format(‘woff’);
}
@font-face {
font-family: ‘Open Sans’;
font-style: italic;
font-weight: 600;
src: local(‘Open Sans Semibold Italic’), local(‘OpenSans-SemiboldItalic’), url(../fonts/google/PRmiXeptR36kaC0GEAetxmWeb5PoA5ztb49yLyUzH1A.woff) format(‘woff’);
}
——————代码区end————————

修改 \wp-includes\script-loader.php 文件,找到

$open_sans_font_url = “//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600subset=$subsets”;

替换为
$open_sans_font_url = “/wp-includes/css/google-font.css”;

其它方法二:禁止教程

在wp的后台插件里面搜索安装Disable Google Fonts这款插件后启用即可,如果不想安装插件,也可以使用代码版,在主题的functions.php里面加入下面的代码:
——————代码区begin————————

//禁用Open Sans
class Disable_Google_Fonts {
public function __construct() {
add_filter( ‘gettext_with_context’, array( $this, ‘disable_open_sans’ ), 888, 4 );
}
public function disable_open_sans( $translations, $text, $context, $domain ) {
if ( ‘Open Sans font: on or off’ == $context ‘on’ == $text ) {
$translations = ‘off’;
}
return $translations;
}
}
$disable_google_fonts = new Disable_Google_Fonts;
——————代码区end————————

参考:
http://www.niuguoxin.com/dishui/website/wordpress/172.html
http://devework.com/google-fonts-in-wordpress.html

nginx perl cgi错误排除

nginx执行perl cgi报错:

Error: No such CGI app - may not exist or is not executable by this process.

排除权限问题。修改nginx配置文件,增加如下配置:

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;

故障排除。

httpd服务排错一例

服务器重启后,网站访问报错:

Service Temporarily Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

apache日志:

[Thu Oct 23 11:50:06 2014] [error] [client …] (2)No such file or directory: unable to connect to cgi daemon after multiple tries: /…/extmail/cgi/index.cgi

重启httpd服务,访问恢复正常,原因不明。

/etc/init.d/httpd restart

centos 7 支持ntfs、exfat(fat64)文件系统

FUSE:用户空间文件系统(Filesystem in Userspace),是Linux 中用于挂载某些网络空间,如SSH,到本地文件系统的模块。

rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
ntfs分区读写支持:
yum install fuse-ntfs-3g

exfat(fat64)支持是通过fuse模块的方式支持的
http://download1.rpmfusion.org/free/el/updates/6/SRPMS/repoview/index.html
wget http://download1.rpmfusion.org/free/el/updates/6/SRPMS/fuse-exfat-1.0.1-2.el6.src.rpm
wget http://download1.rpmfusion.org/free/el/updates/6/SRPMS/exfat-utils-1.0.1-2.el6.src.rpm

useradd mockbuild

yum install scons gcc
yum install fuse-devel

rpm -ihv fuse-exfat-1.0.1-2.el6.src.rpm exfat-utils-1.0.1-2.el6.src.rpm
cd /root/rpmbuild/
cd SPECS/
rpmbuild -ba fuse-exfat.spec
rpmbuild -ba exfat-utils.spec
cd ../RPMS/x86_64/
rpm -ihv exfat-utils-1.0.1-2.el7.centos.x86_64.rpm fuse-exfat-1.0.1-2.el7.centos.x86_64.rpm

centos 7 添加第三方yum源

EPEL源

rpm -Uvh http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm

Remi源
rpm -Uvh http://mirrors.hustunique.com/remi/enterprise/remi-release-7.rpm

RPM Fusion源

rpm -Uvh http://download1.rpmfusion.org/free/el/updates/6/x86_64/rpmfusion-free-release-6-1.noarch.rpm

yum install yum-priorities -y

EPEL源
EPEL,即Extra Packages for Enterprise Linux,是由 Fedora 社区创建维护,为 RHEL 及衍生发行版如 CentOS、Scientific Linux 等提供高质量软件包的项目。EPEL中含有大量的软件,对官方标准源是一个很好的补充。
“EPEL (Extra Packages for Enterprise Linux ) is a Fedora Special Interest Group that creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL).”
wiki:http://fedoraproject.org/wiki/EPEL
Fedora EPEL 下载:http://mirrors.fedoraproject.org/publiclist/EPEL/
EPEL 下载地址:http://fedoraproject.org/wiki/EPEL

Remi源
Remi源中的软件几乎都是最新稳定版。
Remi下载地址:http://rpms.famillecollet.com/

RPM Fusion源

RPM Fusion provides software that the Fedora Project or Red Hat doesn’t want to ship. That software is provided as precompiled RPMs for all current Fedora versions and Red Hat Enterprise Linux 5 , 6 and 7; you can use the RPM Fusion repositories with tools like yum and PackageKit.

RPM Fusion is a merger of Dribble, Freshrpms, and Livna; our goal is to simplify end-user experience by grouping as much add-on software as possible in a single location.

RepoForge源
RepoForge(前RPMForge)是CentOS系统下的软件仓库,拥有4000多种的软件包,被CentOS社区认为是最安全也是最稳定的一个软件仓库。The RepoForge project maintains RPM packages for Red Hat Enterprise Linux (RHEL), CentOS Linux. It provides a set of repositories compatible with various RHEL-derived distributions.

http://repoforge.org/use/

rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

centos 6 参考http://veryi.com/w/706.html