生产环境下MySQL服务配置优化参考样本/CentOS 6.x MySQL 5.1/CentOS 7.x MariaDB 5.5

两份mysql配置文件,分别是实体机生产环境下与vps下的两个版本,MySQL5.1与5.5差异不大,常规设置可以通用。后面另有二进制日志相关的配置。

注意事项:如果修改了innodb_*参数,尤其是修改了innodb_log_file_size ,启动前要删除/var/lib/mysql/ib_logfile{0,1}两个文件,启动后一定要检查一下mysql日志,是否有相关错误或警告消息。

环境 CentOS 6.x 自带的MySQL 5.1.73

在原始配置文件  /etc/my.cnf 基础上,在 [mysqld] 节内增加配置参数。实际应用中,请按硬件及负载酌情修改。

#add by feng 120418  --------------------------
#skip-locking
skip-name-resolve
skip-external-locking
key_buffer_size = 256M
#table_cache = 3072
table_open_cache = 3072
read_buffer_size = 2M
read_rnd_buffer_size = 2M
sort_buffer_size = 2M
myisam_sort_buffer_size = 256M
thread_cache_size = 8
query_cache_size= 512M
query_cache_limit= 5M
tmp_table_size=1024M
max_heap_table_size=3000M
max_allowed_packet = 16M
innodb_buffer_pool_size = 512M
innodb_log_file_size = 512M
innodb_additional_mem_pool_size=512M
innodb_log_buffer_size=64M
max_connections=2000
max_user_connections=800
join_buffer_size = 8M
open_files_limit = 65535
#tmpdir=/dev/shm
max_connect_errors=1000
#add by feng 120418  end ---------------------

1-2G内存的个人VPS下配置参考

因为开启了主从复制,会产生大量二进制日志占用磁盘空间。如不需要,可以删除复制相关行。其中key_buffer_size, innodb_buffer_pool_size 设置为32M与 64M,事实上这都嫌大浪费资源了,看实际需要吧,内存资源紧张可酌情改小点。

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

#add by fengyqf start
skip-name-resolve

innodb_log_buffer_size=32M
innodb_buffer_pool_size=64M
innodb_log_file_size=16M
innodb_additional_mem_pool_size=16M
key_buffer_size=32M

#replication safe for innodb engine
innodb_flush_logs_at_commit
innodb_support_xa=1


#replication
server-id=100
log-bin=mysql-bin
log-error=mysql-bin.err
expire_logs_days=30
sync_binlog=1
binlog_format=MIXED
#add by fengyqf end

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

从服务器配置

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

skip-name-resolve

server-id=201
log-bin=mysql-bin
relay_log=/var/lib/mysql/mysql-relay-bin
log_slave_updates=1
read_only=1
binlog_format=MIXED


[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

二进制日志的定期清理或手工清理

定时清理。通过参数 expire_logs_days 指定过期天数,过期自动清理;具体天数据按实际情况定(空间与同步延迟等)。该参数可运行时设定。

expire_logs_days = 10 

手工清理。root登录mysql客户端,执行purge命令。

> PURGE {MASTER | BINARY} LOGS TO 'log_name'
> PURGE {MASTER | BINARY} LOGS BEFORE 'date'

其中 log_name是show master logs; 显示的日志文件名,如 mysql-bin.000001. 应用举例:

> PURGE MASTER LOGS TO 'mysql-bin.000003';  //清除mysql-bin.000003(含)之前的日志
> PURGE MASTER LOGS BEFORE '2016-11-05 10:00:00';   //清除2016-11-05 10:00:00前的日志
> PURGE MASTER LOGS BEFORE DATE_SUB(NOW(),INTERVAL 3 DAY);
  //清除3天前日志,使用BEFORE函数计算日期,变量的date自变量还可以为'YYYY-MM-DD hh:mm:ss'格式。详查手册

清理二进制日志的影响。如果当前服务器有一个活跃的从属服务器,该从服务器当前正在读取您正在试图删除的日志之一,则本语句不会起作用,而是会失败,并伴随一个错误。不过,如果从属服务器是休止的,并且您碰巧清理了其想要读取的日志之一,则从属服务器启动后不能复制。当从属服务器正在复制时,本语句可以安全运行。您不需要停止它们。(参考

 

CentOS服务器安装后一系列配置参考(CentOS 6.x/CentOS 7)

iptables

CentOS 官方iptables规则:开启ssh端口,允许icmp/ping,不接受其它连接;拒绝FORWARD转发。这是科学的,如果有需要开放的端口再做手工开启。

如果没有默认规则文件 /etc/sysconfig/iptables ,可见自行yum安装 yum install iptables-services,然后 service iptables restartsystemctl restart iptables 加载默认规则,通过iptables命令修改过规则后  service iptables save 保存规则。默认配置文件如下,可参考使用。

# Generated by iptables-save v1.4.7 on Sat Dec 17 10:11:38 2011
# Manual customization of this file is not recommended.
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

sshd: 端口

ssh的服务器端,重要性不需多讲。

其主配置文件 /etc/ssh/sshd_config  (注意不是 /etc/ssh/ssh_config),下面sshd相关配置都在该文件上修改

改一下监听端口,虽然刻意扫描你,还是没的跑,但起码隐藏了一点点。大概13行,Port指令,默认是注释掉的,取消注释,将其后端口号22改成你想要改的,下面以12345为例。注意不要超过65535,不要使用其它已监听端口

Port 12345

[至关重要] iptables里打开相关端口,不要断开当前连接、重启sshd 服务,保存iptables配置到磁盘(以备下次开机时自动生效)

# iptables -I INPUT 4 -m state --state NEW -p tcp --dport 12345 -j ACCEPT

再开一个ssh客户端测试连接,确保改后的端口可以连接。(即使已改过端口,当前连接也还是会保持的)

指定自定义端口的ssh连接: ssh -p 12345  username@your.host.ip

sshd: 用户白名单

限制一下允许通过ssh远程登录的用户名(白名单),可以在文件结尾增加如下一行

AllowUsers user1 user2 user3

其中的user1 user2 user3 是允许通过ssh远程登录的用户,多个用户使用空格分隔。当然,你要事先创建这些普通用户,不然下次就连不上了。

sshd: 禁止root用户直接通过ssh登录

被暴力破解root密码是一件经常遇到的事情,所以严重推荐禁止掉,尤其是使用默认22端口时。增加下一行配置

PermitRootLogin no

日期时间的自动同步

首先确保rdate已安装,使用美国授时中心服务器,加入到crontab,每周日同步一次

# crontab -e
* * * * 0 rdate -s time.nist.gov

详细可参考 linux下日期时间自动同步设置(rdate,ntpdate两种方法)

yum源

开启epel源

CentOS官方yum默认包含了epel-release的yum源,直接安装即可。

yum install epel-release

排除某些rpm包

编辑yum主配置文件 /etc/yum.conf ,在[main] 节点里增加一行exclude指令。比如启用第三方内核时,运行yum更新时,若kernel*有更新,默认内核就会变成官方内核;为避免这个麻烦,可以把kernel*包从yum更新中排除掉。排除多个包可以空格隔开列在同一行,示例如下

exclude=kernel* httpd*

nginx

如果使用nginx的话,可以使用nginx的官方yum源。当然里面只有nginx,没有别的包,所以不会破坏centos原装包的依赖关系。创建/etc/yum.repos.d/nginx.repo内容如下

[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key

详细参考nginx官方yum源说明 

 

SELinux

这货很强悍,然而有时也很麻烦,尤其是不够熟的时候,可以考虑关闭,配置在文件 /etc/sysconfig/selinux 中设置 SELINUX=disabledSELINUX=permissive

Grub 2 及第三方内核相关的设置

CentOS 7的Grub2 改变有点大,设置被拆到个文件中,比如 /boot/grub2/grub.cfg, /etc/default/grub/boot/grub2/grubenv 等。注意不要手工编辑grub.cfg。

如果使用的第三方内核,要注意指定默认启动的内核。默认情况下/etc/default/grub里设置了 GRUB_DEFAULT=saved ,要通过/boot/grub2/grubenv指定,但也不要手工修改该文件,而是使用 grub2-set-default 命令的设置。如下三行 1) 列出grub.cfg里的menuentry名称,  2) 设置默认项 grub2-set-default   3) 查看grubenv确认默认项saved_entry

grep "^menuentry" /boot/grub2/grub.cfg |cut -d "'" -f2
grub2-set-default "{menuentry 名称}"
grub2-editenv list

Grub2 参考CentOS 官方文档: https://wiki.centos.org/zh/HowTos/Grub2

开启BBR

实体机/KVM/Xen的VPS下,使用第三方内核开启BBR

本节适用实体机或KVM、Xen虚拟化下的VPS(此方法不支持OpenVZ)。CentOS7官方内核较老,不支持BBR,可使用 ELRepo Project 预编译的内核。其中rpm包url可能会不定期更新,以官方最新为准。(另CentOS6可使用Fedora Copr上项目kernel-el6/

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
yum install https://www.elrepo.org/elrepo-release-7.0-4.el7.elrepo.noarch.rpm
yum --enablerepo=elrepo-kernel install kernel-ml -y

参考上节Grub2默认内核做设置,完成后重启,确认内核生效无误。然后再继续。这里最好。

echo 'net.core.default_qdisc=fq' | tee -a /etc/sysctl.conf
echo 'net.ipv4.tcp_congestion_control=bbr' | tee -a /etc/sysctl.conf
sysctl -p

完成后,下面命令确认生效

sysctl net.ipv4.tcp_available_congestion_control
sysctl -n net.ipv4.tcp_congestion_control
lsmod | grep bbr

其输出应该是 net.ipv4.tcp_available_congestion_control = bbr cubic renobbr 及 tcp_bbr 16384 0 (后一行输出的数字可能不同)。

至此bbr启用完成。但,强烈推荐,参考前节“排除某些rpm包”,把kernel* 包从yum更新中排除掉;否则,下次yum更新后,grub默认内核将换成centos官方内核,bbr就没了。

详细可参看 https://www.vultr.com/docs/how-to-deploy-google-bbr-on-centos-7

魔改版BBR(OpenVZ VPS下可用)

基于OpenVZ的 VPS上面方法不支持,得使用魔改版BBR,要求CentOS 7以上(事实上CentOS 6(x64)也可以,但必须升级glibc),一键安装脚本,照提示操作即可。

curl https://raw.githubusercontent.com/linhua55/lkl_study/master/get-rinetd.sh | bash

运行中会提示输入端口号,如有多个端口号用空格隔开(不支持端口段)。如需要增减端口,可修改配置文件 /etc/rinetd-bbr.conf

详细参看作者的github项目

MySQL-Server

配置参考 一份生产环境下MySQL服务配置优化参考样本 (请按硬件及负载酌情修改)

备份脚本,加入到crontab中,定时执行。注意其中备份存储目录、待备份数据库列表、及备份用户账号密码

#!/bin/bash
# Program:
#      auto backup mysql database
# History:
# 2012/05/14    fengyqf First release
#backup folder, with the last slash "/"
backup_folder="/home/user/backup/mysql/"
filename=`date +_%Y%m%d_%N`

for db in db1 db2 db3
do
mysqldump -hlocalhost --opt -e --max_allowed_packet=1048576 --net_buffer_length=16384 -uroot -pYourMysqlRootPassword $db |gzip > $backup_folder$db$filename.sql.gz
done

其它置参考

ulimit, 文件描述符 http://www.path8.net/tn/archives/2024

sysctl, 内核优化 #TODO#

 

CentOS 6.x/apache 2.2下php多版本共存探索(模块及fastCGI)/mod_fcgi,mod_proxy_fcgi实现

在apache下整合fastCGI模式运行的php-fpm,似乎网上很少相关材料,就连英文版材料也少。只要是php-fpm,基本上都是与nginx搭配。查了一大批相关资料,写本文总结一下。

apache下有多个fastCGI的支持方案:至少有mod_fcgimod_fastcgigit)、mod_proxy_fcgi等。这两个模块都有点老,尤其mod_fastcgi自从2007年以来就没有更新,略掉不谈,事实上没用过用。mod_proxy_fcgi模块是httpd 2.4+的版本正式引入,通过简洁的一行 ProxyPassMatch 指令即可。

mod_fcgi

mod_fcgi模块本身是做fastCGI进程管理的,使用它就不需要使用php-fpm管理进程了。核心配置参数

LoadModule fcgid_module modules/mod_fcgid.so
<VirtualHost *:80>
    DocumentRoot "/var/www/html/site_1"
    ServerName "www.yourhost.com"
    DirectoryIndex index.html index.php
    #php.ini的存放目录,Linux下通常不需要
    #FcgidInitialEnv PHPRC "D:/php"
    # 设置PHP_FCGI_MAX_REQUESTS大于或等于FcgidMaxRequestsPerProcess,防止php-cgi进程在处理完所有请求前退出
    FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000
    #php-cgi每个进程的最大请求数
    FcgidMaxRequestsPerProcess 1000
    #php-cgi最大的进程数
    FcgidMaxProcesses 3
    #最大执行时间
    FcgidIOTimeout 600
    FcgidIdleTimeout 600
    #php-cgi的路径
    FcgidWrapper /usr/local/php7/bin/php-cgi .php
    AddHandler fcgid-script .php
    FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000
    <Directory "/var/www/html/site_1">
        Options +ExecCGI
    </Directory>
</VirtualHost>

其中粗体着色是必须参数,其它几个Fcgid*指令,是优化之用,这里仅示例,要按实际情况调整数值。具体参看mod_fcgi官方文档

使用mod_fcgid的几个特点

  1. php-fgi进程是由apache模块启动并管理,不需要配置php-fpm
  2. 在php-cig进程以apache用户身份运行,php程序写的文件,其权限为apache用户(而不像php-fpm下写文件为php-fpm用户所有,默认是nobody),这样在目录权限管理方面一致性高些。

mod_fastcgi

虽然CentOS 6.x下是apache 2.2,但所幸已经有人成功移植: https://github.com/ceph/mod-proxy-fcgi 我们可以直接使用;更幸运的是它已经进入epel源,直接yum安装即可;不想匹配epel源的,直接下载rpm包安装也可以(示例 http://mirrors.ustc.edu.cn/epel/6/x86_64/

当然可以重新编译安装apache 2.4, 这样直接有mod_proxy_fcgi可以使用,但这里还是保持原版本不变,省掉编译的工作量。

参考mod_proxy_fcgi官方文档,整合php-fpm的配置指令

ProxyPassMatch "^/myapp/.*\.php(/.*)?$" "fcgi://localhost:9000/var/www/"

语法很简单,跟配置反向代理类似,可以按实际需要做修改。事实上与mod_proxy模块语法一致的,不同处是将http协议改成fcig协议。

以上是apache整合php-fpm模式运行的fastCGI,接下来要对yum安装的php做下配置修改。

yum安装的php配置文件 /etc/httpd/conf.d/php.conf ,其中有如下一行

AddHandler php5-script .php

我们要对不同的站点启用不同的php,上面一行是对全局的.php文件分配给php模块处理,我们把这一行注释掉。而是在每个站点启用不同的php运行模式。

以上即是处理方式。

[已知问题]:裸目录地址转发

有一个困扰的问题没有解决,感觉有点像模块bug:

对于配置了DirectoryIndex index.php的目录,如果其子目录没有index.php,上述ProxyPassMatch还是会做fastCGI转发,这时会看到php-fpm的404响应,而不是apache的响应403页面。但前面的规则并不转发这裸空目录的url,所以感觉像bug

再者就是,对于ProxyPassMatch匹配的目录,apache自动索引功能失效。(当然如果不开启autoindex就无所谓了。生产环境下通常不开启的)

其它,似乎也没有什么严重后果,或者我没还意识到(?)。

解决方法:每个目录下,都放置一个index.html,避免fpm-php处理空请求

 

一系列git设置选项/fetch,push走socks5代理/一份简单的gitignore文件

简述

git的设置一般通过 git config 命令,在本地仓库里的实际配置文件为 .git/config ,全局设置则在操作系统用户目录下 ~/.gitconfig

网络代理

连接远端服务器的操作,如fetch, push 等,如果需要走代理的情况,如果 远端仓库是 http 协议,则比较简单,  git config http.proxy=http://127.0.0.1:1080

不过,通常情况下 ssh 协议使用更广泛,这就要借助ssh的设置了(而不是git本身的设置),配置文件是 ~/.ssh/config  ,比如设置 github.com走1080端口的socks5代理,示例如下,注意其中 ProxyCommand  一行

Host github.com
HostName github.com
Port 22
# #User feng
IdentityFile ~/.ssh/id_rsa
ProxyCommand /usr/bin/nc -X 5 -x 127.0.0.1:1080 %h %p

基于ssh的用户认证

鉴于ssh协议使用更方便,这也就需要其配置文件,~/.ssh/config  , 如上节的示例,指定了对应的用户(User)的ssh密钥文件(IdentityFile) ,上面的其实就是ssh默认选项,一般情况下,不需要另外配置,这样写,只是方便参照做修改自定义。当然还有更多选项,可参考ssh的手册。

一份简单的gitignore文件

如下

*.bak
*.swp
.idea/
*.bak
*.~
.DS_Store
nbproject/*
*.swp
*.iml
_git_*
*_bak*
logs/
*.log
data/
uploads/
_build

没了,有需要的时候再往里面加。

主要是个人使用,放这里备忘。

linux/centos上安装配置gitosis(git服务器端)

gitosis长期没有更新了,换gitolite吧,或gitlab也行

[个人按本文方法是可以安装gitosis的,但在客户端git clone总是失败,也无法成功创建repo,所以个人改用gitolite,感觉比gitosis简单一些,而且一安装就可以正常工作]

安装gitosis,因为centos/redhat官方源不带gitosis,所以需要先添加EPEL软件仓库,或者手工下载gitosis的 rpm包及依赖包并手工安装。

gitosis rpm包安装后,会自动创建一个gitosis用户,为了简化其见,手工对其改名,改成git,涉及以下四个文件/etc/passwd, /etc/shadow, /etc/group, /etc/gshadow . 默认情况下,git用户(即改名前的gitosis用户)的home目录为 /var/lib/gitosis

这是git用户是作为git的管理账号之用。因为此时git用户没有设置登录密码,我们也不需要其密码,而是使用ssh密钥登录。但对gitosis的设置还是使用git用户登录比较方便。可以切换到root用户,然后 su git .

为git用户设置ssh密钥登录。上传一个ssh公钥,建议使用你的常用账号下的ssh公钥。并将其加入git用户的authorized_keys

sh-4.1$ cd ~/.ssh/
sh-4.1$ cat id_rsa.pub >>authorized_keys

确认可以使用公钥通过ssh登录。关于使用公钥自动登录ssh主机,更多可以参看这里 ssh无密码登入设置(完全版)/linux下免输入密码ssh登录

下面初始化gitosis . 要使用git用户执行下面命令

gitosis-init < [path of your id_rsa.pub]

结果大致如下

sh-4.1$ gitosis-init < id_rsa.pub
Initialized empty Git repository in /var/lib/gitosis/repositories/gitosis-admin.git/
Reinitialized existing Git repository in /var/lib/gitosis/repositories/gitosis-admin.git/
sh-4.1$ ls
gitosis  repositories

可以看到被创建的两个目录,gitosis与repositories .

运行 git clone git@localhost:repositories/gitosis-admin.git 即可把git管理配置文件的目同步到本地。需要修改配置,就在本地修改,然后git commit;git push同步到服务器上即可以即时生效了

关于gitosis资料,参考 http://linux-wiki.cn/wiki/zh-hans/%E9%85%8D%E7%BD%AEgitosis%EF%BC%88%E4%BB%A5CentOS%E4%B8%BA%E4%BE%8B%EF%BC%89

http://git-scm.com/book/zh/服务器上的-Git-Gitosis

http://git-scm.com/book/zh/%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%8A%E7%9A%84-Git-%E5%9C%A8%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%8A%E9%83%A8%E7%BD%B2-Git

设置ssh自动登录远程主机的配置要点

本地生成的的RSA密钥传需要传到远程主机相应用户家目录下的.ssh子目录下,注意该子目录的权限设置是有严格要求的:其所属用户当然是该用户,其权限应该是700, 即不允许其它用户进入并访问该目录;否则,无法自动登录的。

这种情况下,使用ssh 的-v参数显示详细消息大致如下:

$ ssh -v feng@myremote.host.net
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to myremote.host.net [50.116.14.251] port 22.
debug1: Connection established.
debug1: identity file /home/feng/.ssh/identity type -1
debug1: identity file /home/feng/.ssh/id_rsa type 1
debug1: identity file /home/feng/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'myremote.host.net' is known and matches the RSA host key.
debug1: Found key in /home/feng/.ssh/known_hosts:8
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
Credentials cache file '/tmp/krb5cc_501' not found

debug1: Unspecified GSS failure.  Minor code may provide more information
Credentials cache file '/tmp/krb5cc_501' not found

debug1: Unspecified GSS failure.  Minor code may provide more information

debug1: Unspecified GSS failure.  Minor code may provide more information

debug1: Next authentication method: publickey
debug1: Offering public key: /home/feng/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Offering public key: .ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /home/feng/.ssh/identity
debug1: Trying private key: /home/feng/.ssh/id_dsa
debug1: Next authentication method: password
feng@myremote.host.net's password:

了解关于ssh免密码登录,强烈推荐这篇文章,基于ssh密钥对的自动登录原理及实际操作

另请参看 ssh无密码登入设置(完全版)/linux下免输入密码ssh登录

mysql修改配置参数innodb_log_file_size后不能正常工作,在phpmyadmin中innodb表状态为“使用中”

问题:修改mysql配置参数innodb_log_file_size 后,可能无法正常启用,或者innodb表将不能工作,在phpmyadmin中显示为“使用中”

解决方法:先停掉mysql,然后删掉旧innodb日志文件后,再启动mysqld就可以正常启用了.innodb旧日志文件位于mysql data 目录下的ib_logfile0, ib_logfile1 文件

innodb日志文件在linux下的典型位置为 /var/lib/mysql
在windows下则默认位于安装目录下的data子目录里。

原因:是旧的innodb日志文件,与改后的innodb_log_file_size不匹配,所以造成mysql不能正常工作。

从某主机商的虚拟主机上拷出来的apache 主配置文件

从美橙互联虚拟主机上拷出来的apache 主配置文件/etc/httpd/conf/httpd.conf

#
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See for detailed information.
# In particular, see
#
# for a discussion of each configuration directive.
#
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# The configuration directives are grouped into three basic sections:
# 1. Directives that control the operation of the Apache server process as a
# whole (the 'global environment').
# 2. Directives that define the parameters of the 'main' or 'default' server,
# which responds to requests that aren't handled by a virtual host.
# These directives also provide default values for the settings
# of all virtual hosts.
# 3. Settings for virtual hosts, which allow Web requests to be sent to
# different IP addresses or hostnames and have them handled by the
# same Apache server process.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"
# with ServerRoot set to "/etc/httpd" will be interpreted by the
# server as "/etc/httpd/logs/foo.log".
#

### Section 1: Global Environment
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.
#

#
# Don't give away too much information about all the subcomponents
# we are running. Comment out this line if you don't mind remote sites
# finding out what major optional modules you are running
ServerTokens OS

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE! If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the LockFile documentation
# (available at );
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
ServerRoot "/etc/httpd"

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
PidFile run/httpd.pid

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 120

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive Off

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15

##
## Server-Pool Size Regulation (MPM specific)
##

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves

StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves

StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen 80

#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_alias_module modules/mod_authn_alias.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule ldap_module modules/mod_ldap.so
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule expires_module modules/mod_expires.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule info_module modules/mod_info.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule cache_module modules/mod_cache.so
LoadModule suexec_module modules/mod_suexec.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule version_module modules/mod_version.so

#
# The following modules are not loaded by default:
#
#LoadModule cern_meta_module modules/mod_cern_meta.so
#LoadModule asis_module modules/mod_asis.so

#
# Load config files from the config directory "/etc/httpd/conf.d".
#
Include conf.d/*.conf

#
# ExtendedStatus controls whether Apache will generate "full" status
# information (ExtendedStatus On) or just basic information (ExtendedStatus
# Off) when the "server-status" handler is called. The default is Off.
#
#ExtendedStatus On

#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# . On SCO (ODT 3) use "User nouser" and "Group nogroup".
# . On HPUX you may not be able to use shared memory as nobody, and the
# suggested workaround is to create a user www and use that user.
# NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
# when the value of (unsigned)Group is above 60000;
# don't use Group #-1 on these systems!
#
User apache
Group apache

### Section 2: 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# definition. These values also provide defaults for
# any containers you may define later in the file.
#
# All of these directives may appear inside containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#

#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin root@localhost

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work. See also the UseCanonicalName directive.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
#
#ServerName www.example.com:80

#
# UseCanonicalName: Determines how Apache constructs self-referencing
# URLs and the SERVER_NAME and SERVER_PORT variables.
# When set "Off", Apache will use the Hostname and Port supplied
# by the client. When set "On", Apache will use the value of the
# ServerName directive.
#
UseCanonicalName Off

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/html"

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#

Options FollowSymLinks
AllowOverride None

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#

#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
# The path to the end user account 'public_html' directory must be
# accessible to the webserver userid. This usually means that ~userid
# must have permissions of 711, ~userid/public_html must have permissions
# of 755, and documents contained therein must be world-readable.
# Otherwise, the client will only receive a "403 Forbidden" message.
#
# See also: http://httpd.apache.org/docs/misc/FAQ.html#forbidden
#

#
# UserDir is disabled by default since it can confirm the presence
# of a username on the system (depending on home directory
# permissions).
#
UserDir disable

#
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disable" line above, and uncomment
# the following line instead:
#
#UserDir public_html

#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
#
# AllowOverride FileInfo AuthConfig Limit
# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
# # Order allow,deny
# Allow from all
# # # Order deny,allow
# Deny from all
# #

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
# The index.html.var file (a type-map) is used to deliver content-
# negotiated documents. The MultiViews Option can be used for the
# same purpose, but it is much slower.
#
DirectoryIndex index.html index.html.var

#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#

Order allow,deny
Deny from all

#
# TypesConfig describes where the mime.types file (or equivalent) is
# to be found.
#
TypesConfig /etc/mime.types

#
# DefaultType is the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain

#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#

# MIMEMagicFile /usr/share/magic.mime
MIMEMagicFile conf/magic

#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

#
# EnableMMAP: Control whether memory-mapping is used to deliver
# files (assuming that the underlying OS supports it).
# The default is on; turn this off if you serve from NFS-mounted
# filesystems. On some systems, turning it off (regardless of
# filesystem) can improve performance; for details, please see
# http://httpd.apache.org/docs/2.2/mod/core.html#enablemmap
#
#EnableMMAP off

#
# EnableSendfile: Control whether the sendfile kernel support is
# used to deliver files (assuming that the OS supports it).
# The default is on; turn this off if you serve from NFS-mounted
# filesystems. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#enablesendfile
#
#EnableSendfile off

#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a
# container, that host's errors will be logged there and not here.
#
ErrorLog logs/error_log

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# "combinedio" includes actual counts of actual bytes received (%I) and sent (%O); this
# requires the mod_logio module to be loaded.
#LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a
# container, they will be logged here. Contrariwise, if you *do*
# define per- access logfiles, transactions will be
# logged therein and *not* in this file.
#
#CustomLog logs/access_log common

#
# If you would like to have separate agent and referer logfiles, uncomment
# the following directives.
#
#CustomLog logs/referer_log referer
#CustomLog logs/agent_log agent

#
# For a single logfile with access, agent, and referer information
# (Combined Logfile Format), use the following directive:
#
CustomLog logs/access_log combined

#
# Optionally add a line containing the server version and virtual host
# name to server-generated pages (internal error documents, FTP directory
# listings, mod_status and mod_info output etc., but not CGI generated
# documents or custom error documents).
# Set to "EMail" to also include a mailto: link to the ServerAdmin.
# Set to one of: On | Off | EMail
#
ServerSignature On

#
# Aliases: Add here as many aliases as you need (with no limit). The format is
# Alias fakename realname
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL. So "/icons" isn't aliased in this
# example, only "/icons/". If the fakename is slash-terminated, then the
# realname must also be slash terminated, and if the fakename omits the
# trailing slash, the realname must also omit it.
#
# We include the /icons/ alias for FancyIndexed directory listings. If you
# do not use FancyIndexing, you may comment this out.
#
Alias /icons/ "/var/www/icons/"
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all

#
# WebDAV module configuration section.
#

# Location of the WebDAV lock database.
DAVLockDB /var/lib/dav/lockdb

#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

#
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#

AllowOverride None
Options None
Order allow,deny
Allow from all

#
# Redirect allows you to tell clients about documents which used to exist in
# your server's namespace, but do not anymore. This allows you to tell the
# clients where to look for the relocated document.
# Example:
# Redirect permanent /foo http://www.example.com/bar

#
# Directives controlling the display of server-generated directory listings.
#

#
# IndexOptions: Controls the appearance of server-generated directory
# listings.
#
IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable

#
# AddIcon* directives tell the server which icon to show for different
# files or filename extensions. These are only displayed for
# FancyIndexed directories.
#
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*

AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core

AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^

#
# DefaultIcon is which icon to show for files which do not have an icon
# explicitly set.
#
DefaultIcon /icons/unknown.gif

#
# AddDescription allows you to place a short description after a file in
# server-generated indexes. These are only displayed for FancyIndexed
# directories.
# Format: AddDescription "description" filename
#
#AddDescription "GZIP compressed document" .gz
#AddDescription "tar archive" .tar
#AddDescription "GZIP compressed tar archive" .tgz

#
# ReadmeName is the name of the README file the server will look for by
# default, and append to directory listings.
#
# HeaderName is the name of a file which should be prepended to
# directory indexes.
ReadmeName README.html
HeaderName HEADER.html

#
# IndexIgnore is a set of filenames which directory indexing should ignore
# and not include in the listing. Shell-style wildcarding is permitted.
#
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

#
# DefaultLanguage and AddLanguage allows you to specify the language of
# a document. You can then use content negotiation to give a browser a
# file in a language the user can understand.
#
# Specify a default language. This means that all data
# going out without a specific language tag (see below) will
# be marked with this one. You probably do NOT want to set
# this unless you are sure it is correct for all cases.
#
# * It is generally better to not mark a page as
# * being a certain language than marking it with the wrong
# * language!
#
# DefaultLanguage nl
#
# Note 1: The suffix does not have to be the same as the language
# keyword --- those with documents in Polish (whose net-standard
# language code is pl) may wish to use "AddLanguage pl .po" to
# avoid the ambiguity with the common suffix for perl scripts.
#
# Note 2: The example entries below illustrate that in some cases
# the two character 'Language' abbreviation is not identical to
# the two character 'Country' code for its country,
# E.g. 'Danmark/dk' versus 'Danish/da'.
#
# Note 3: In the case of 'ltz' we violate the RFC by using a three char
# specifier. There is 'work in progress' to fix this and get
# the reference data for rfc1766 cleaned up.
#
# Catalan (ca) - Croatian (hr) - Czech (cs) - Danish (da) - Dutch (nl)
# English (en) - Esperanto (eo) - Estonian (et) - French (fr) - German (de)
# Greek-Modern (el) - Hebrew (he) - Italian (it) - Japanese (ja)
# Korean (ko) - Luxembourgeois* (ltz) - Norwegian Nynorsk (nn)
# Norwegian (no) - Polish (pl) - Portugese (pt)
# Brazilian Portuguese (pt-BR) - Russian (ru) - Swedish (sv)
# Simplified Chinese (zh-CN) - Spanish (es) - Traditional Chinese (zh-TW)
#
AddLanguage ca .ca
AddLanguage cs .cz .cs
AddLanguage da .dk
AddLanguage de .de
AddLanguage el .el
AddLanguage en .en
AddLanguage eo .eo
AddLanguage es .es
AddLanguage et .et
AddLanguage fr .fr
AddLanguage he .he
AddLanguage hr .hr
AddLanguage it .it
AddLanguage ja .ja
AddLanguage ko .ko
AddLanguage ltz .ltz
AddLanguage nl .nl
AddLanguage nn .nn
AddLanguage no .no
AddLanguage pl .po
AddLanguage pt .pt
AddLanguage pt-BR .pt-br
AddLanguage ru .ru
AddLanguage sv .sv
AddLanguage zh-CN .zh-cn
AddLanguage zh-TW .zh-tw

#
# LanguagePriority allows you to give precedence to some languages
# in case of a tie during content negotiation.
#
# Just list the languages in decreasing order of preference. We have
# more or less alphabetized them here. You probably want to change this.
#
LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW

#
# ForceLanguagePriority allows you to serve a result page rather than
# MULTIPLE CHOICES (Prefer) [in case of a tie] or NOT ACCEPTABLE (Fallback)
# [in case no accepted languages matched the available variants]
#
ForceLanguagePriority Prefer Fallback

#
# Specify a default charset for all content served; this enables
# interpretation of all content as UTF-8 by default. To use the
# default browser choice (ISO-8859-1), or to allow the META tags
# in HTML content to override this choice, comment out this
# directive:
#
AddDefaultCharset Off

#
# AddType allows you to add to or override the MIME configuration
# file mime.types for specific file types.
#
#AddType application/x-tar .tgz

#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
# Despite the name similarity, the following Add* directives have nothing
# to do with the FancyIndexing customization directives above.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz

# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz

#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi

#
# For files that include their own HTTP headers:
#
#AddHandler send-as-is asis

#
# For type maps (negotiated resources):
# (This is enabled by default to allow the Apache "It Worked" page
# to be distributed in multiple languages.)
#
AddHandler type-map var

#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

#
# Action lets you define media types that will execute a script whenever
# a matching file is called. This eliminates the need for repeated URL
# pathnames for oft-used CGI file processors.
# Format: Action media/type /cgi-script/location
# Format: Action handler-name /cgi-script/location
#

#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#

#
# Putting this all together, we can internationalize error responses.
#
# We use Alias to redirect any /error/HTTP_.html.var response to
# our collection of by-error message multi-language collections. We use
# includes to substitute the appropriate text.
#
# You can modify the messages' appearance without changing any of the
# default HTTP_.html.var files by adding the line:
#
# Alias /error/include/ "/your/include/path/"
#
# which allows you to create your own set of files by starting with the
# /var/www/error/include/ files and
# copying them to /your/include/path/, even on a per-VirtualHost basis.
#

Alias /error/ "/var/www/error/"

AllowOverride None
Options IncludesNoExec
AddOutputFilter Includes html
AddHandler type-map var
Order allow,deny
Allow from all
LanguagePriority en es de fr
ForceLanguagePriority Prefer Fallback

# ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
# ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
# ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
# ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
# ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
# ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
# ErrorDocument 410 /error/HTTP_GONE.html.var
# ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
# ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
# ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
# ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
# ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
# ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
# ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
# ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
# ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
# ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var

#
# The following directives modify normal HTTP response behavior to
# handle known problems with browser implementations.
#
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0

#
# The following directive disables redirects on non-GET requests for
# a directory that does not include the trailing slash. This fixes a
# problem with Microsoft WebFolders which does not appropriately handle
# redirects for folders with DAV methods.
# Same deal with Apple's DAV filesystem and Gnome VFS support for DAV.
#
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "MS FrontPage" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
BrowserMatch "^gnome-vfs/1.0" redirect-carefully
BrowserMatch "^XML Spy" redirect-carefully
BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully

#
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
# Change the ".example.com" to match your domain to enable.
#
#
# SetHandler server-status
# Order deny,allow
# Deny from all
# Allow from .example.com
#

#
# Allow remote server configuration reports, with the URL of
# http://servername/server-info (requires that mod_info.c be loaded).
# Change the ".example.com" to match your domain to enable.
#
#
# SetHandler server-info
# Order deny,allow
# Deny from all
# Allow from .example.com
#

#
# Proxy Server directives. Uncomment the following lines to
# enable the proxy server:
#
#
#ProxyRequests On
#
# # Order deny,allow
# Deny from all
# Allow from .example.com
#

#
# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
# Set to one of: Off | On | Full | Block
#
#ProxyVia On

#
# To enable a cache of proxied content, uncomment the following lines.
# See http://httpd.apache.org/docs/2.2/mod/mod_cache.html for more details.
#
#
# CacheEnable disk /
# CacheRoot "/var/cache/mod_proxy"
#
#

#
# End of proxy directives.

### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
#
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#

DocumentRoot /var/www/html
ServerName localhost

Include vhost.d/*.conf

apache 虚拟主机配置文件/etc/httpd/vhost.d/web_user_foobar.ini

<VirtualHost *:80>
SuexecUserGroup web_user_foobar web_user_foobar
DocumentRoot /var/www/virtual/web_user_foobar/home/wwwroot
ServerName web_user_foobar.w69-e0.ezwebtest.com
ServerAlias www.web_user_foobar.com web_user_foobar.com
DirectoryIndex index.html default.htm default.html index.htm default.asp index.asp index.php
ScriptAlias /php5-cgi /var/www/virtual/web_user_foobar/bin/php-cgi
<Directory /var/www/virtual/web_user_foobar/home/wwwroot>
AddHandler php5-cgi .php
Action php5-cgi /php5-cgi
AllowOverride All
Options -Indexes -ExecCGI Includes IncludesNOEXEC FollowSymLinks
Allow from all
</Directory>

ScriptAlias /cgi-bin/ /var/www/virtual/web_user_foobar/home/cgi-bin/
<Directory /var/www/virtual/web_user_foobar/home/cgi-bin/>
Options -Indexes ExecCGI
AllowOverride AuthConfig FileInfo
Allow from all
</Directory>

Alias /error /var/www/virtual/web_user_foobar/home/error
<Directory /var/www/virtual/web_user_foobar/home/error>
AllowOverride None
Options None
Allow from all
</Directory>
ErrorDocument 404 /error/404.html
ErrorDocument 403 /error/403.html
ErrorDocument 500 /error/500.html

CustomLog "|/usr/sbin/rotatelogs -l /var/www/virtual/web_user_foobar/home/logs/web_user_foobar-access_log.%Y.%m.%d 86400" common
ErrorLog "|/usr/sbin/rotatelogs -l /var/www/virtual/web_user_foobar/home/logs/web_user_foobar-error_log.%Y.%m.%d 86400"

CBandScoreboard /var/www/virtual/web_user_foobar/home/logs/bandscore
CBandExceededURL http://info.idccenter.net/err/exceeded.html
CBandLimit 10240Mi
CBandPeriod 30D
CBandSpeed 0 0 0
<Location /cband-stat>
SetHandler cband-status-me
</Location>
</VirtualHost>

firefox弹出窗口错在新标签里打开/phpMyAdmin

使用phpMyAdmin,打开编辑sql语句,正常情况下是在新窗口中打开的,但突然变成新标签了,而且firefox的主窗口大小变成sql语句编辑窗口那么大小,很是难受。

之前也遇到过这种情况,当时是把当前用户目录下的firefox文件全部删掉(或者移走),这样对当前用户而言firefox就成了第一次使用,要重新配置,重新安装插件(当然也可以从备份文件里拷回相应目录、文件),这是一件很麻烦的工作。

这种问题出现过几次了。上次通过删除部分文件的方式,找到问题在于文件prefs.js。该文件里面很多配置项目,似乎是about:config配置项目保存的地方。但没有找到具体是哪一行或几行。

这次就单独针对本文件处理,折半法,删除一半,找问题在于哪一半,然后在有问题的一半里再删除其中一半....如此循环(或许叫递归),最终发现问题在于这样的一行:

user_pref("browser.link.open_newwindow.restriction", 0);

把这一行删掉,就可以了。不过这一行什么时候被添加上,什么时候会出现这样的问题,还不清楚。

phpMyAdmin配置:操作栏只显示“浏览,结构,编辑”等图标不显示文字

phpMyAdmin的强大便捷作用这里就不赘述。下载了phpMyAdmin 3.4.2,最新版本,界面有很大改变,比之前的花哨很多,包括大量的ajax应用。但它默认把操作一栏下的操作图标旁加入了文字,浪费屏幕宽度,使用其自带的config/配置一下,可以只显示图标,具体位置在

自定义主框架 -标签 -

$cfg['PropertiesIconic'] = true;

作相应修改,即可。