wordpress的varnish内存级缓存方案
varnish是优秀的缓存服务器,配置简单,命中率高,性能高效.
下面我们以wordpress博客程序为例看看如何配置varnish.
1、首先安装好web环境,可以使用本站的LNMP一键安装包配置.
2、安装varnish.
rpm --nosignature -i http://repo.varnish-cache.org/redhat/varnish-3.0/el5/noarch/varnish-release-3.0-1.noarch.rpm
yum install varnish
下载default.vcl文件覆盖 /etc/varnish/default.vcl文件. http://centos.googlecode.com/files/default.vcl
3、修改varnish配置文件 /etc/varnish/default.vcl:
backend default {
.host = "127.0.0.1";
.port = "8080";
}
8080端口是后缀nginx或apache的端口.
# Only cache the following site
if (req.http.host ~ "(localhost)") {
set req.backend = default;
} else {
return (pass);
}
这个是只允许localhost缓存,需要改成自己的wordpress域名.
[.........]
set beresp.ttl = 1h;
[.........]
这个是设置缓存页面过期时间为1h,单位可以是s(秒),h(小时),d(天)等.
4、修改 /etc/sysconfig/varnish配置文件: 重要的有两个值:
VARNISH_LISTEN_PORT=80 定义varnish的端口为80.
VARNISH_STORAGE_SIZE=1G 定义varnish最大缓存大小为1G
5、管理varnish的命令
service varnish...
Could not reliably determine the...
在 httpd.conf 第一行添加:
ServerName localhost:82
Nginx+rtmp 搭建流媒体服务器
一. gcc 安装
安装 nginx 需要先将官网下载的源码进行编译,编译依赖 gcc 环境,如果没有 gcc 环境,则需要安装:
yum -y install gcc gcc-c++
二. PCRE pcre-devel 安装
PCRE(Perl Compatible Regular Expressions) 是一个Perl库,包括 perl 兼容的正则表达式库.nginx 的 http 模块使用 pcre 来解析正则表达式,所以需要在 linux 上安装 pcre 库,pcre-devel 是使用 pcre 开发的一个二次开发库.nginx也需要此库.命令:
yum install -y pcre pcre-devel
三. zlib 安装
zlib 库提供了很多种压缩和解压缩的方式, nginx 使用 zlib 对 http 包的内容进行 gzip ,所以需要在 Centos 上安装 zlib 库.
yum install -y zlib zlib-devel
四. OpenSSL 安装
OpenSSL 是一个强大的安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及 SSL 协议,并提供丰富的应用程序供测试或其它目的使用.nginx 不仅支持 http 协议,还支持 https(即在ssl协议上传输http),所以需要在 Centos 安装 OpenSSL 库.
yum install -y openssl openssl-devel
五、安装nginx 跟rtmp模块
1.官网下载直接下载.tar.gz安装包,地址:https://nginx.org/en/download.html.
2.解压:
tar -zxvf nginx-1.13.8.tar.gz
3.下载rtmp 模块, nginx-rtmp-module的官方github地址:
https://github.com/arut/nginx-rtmp-module
4.安装nginx跟rtmp模块:
./configure --prefix=/usr/local/nginx ...
centos安装ganglia
一、安装A.M.P环境
yum install -y httpd mysql mysql-server php php-mysql net-snmp net-snmp-utils
二、编译安装基本环境
源码安装rrdtool没成功,依赖太多了,下面进行yum 安装rrdtool,首先加入dag的yum.
[root@localhost]$ cd /etc/yum.repos.d/
[root@localhost]$ vim dag.repo
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
enabled=1
安装相关依赖:
[root@localhost]#yum -y install apr-devel apr-util check-devel cairo-devel pango-devel libxml2-devel
rpmbuild glib2-devel dbus-devel freetype-devel fontconfig-devel gcc-c++ expat-devel
python-devel libXrender-devel zlib libpng freetype libjpeg fontconfig gd libxml2
pcre pcre-devel libpcre libconfuse libart_lgpl-devel
[root@localhost]# yum install -y rrdtool perl-rrdtool rrdtool-devel
不安装rrdtool-devel在编译ganglia时总是有错误.
三、安装ganglia
wget...
解决memoryalloc12bytesreturnednull.
打开/etc/yum.conf加入下面这行:
exclude=filesystem
重新升级.
在CentOS下安装配置VNC的过程
1.检查vnc客户端和服务器是否已经安装:
[gavin@centos ~]$ rpm -q vnc vnc-server
package vnc is not installed
vnc-server-4.0-8.1
cent os 5已包含vnc的安装包
2.将用户名称加入到配置文件: (注:这里的"用户名"是指linux系统用户的名称)
[gavin@centos ~]$ vi /etc/sysconfig/vncservers
#
# Uncomment the line below to start a VNC server on display :1
# as my 'myusername' (adjust this to your own). You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, see
# http://www.uk.research.att.com/vnc/sshvnc.html>.
# VNCSERVERS="1:myusername"
# VNCSERVERS="1:gavin 2:john" # use the method for more user
VNCSERVERS="1:gavin 2:root 3:root"
# VNCSERVERARGS[1]="-geometry 800x600"
VNCSERVERARGS[1]="-geometry 1024x768"
3.设置用户gavin的密码:
[gavin@centos ~]$ vncpasswd
Password:
Verify:
4.启动VNC服务:
[gavin@centos ~]$ /sbin/service vncserver...