li.nux.ro/nux: 值得使用的一个redhat el7/centos7的rpm/yum源

之前在centos 6下一直用epel+rpmfusion源,但至今(2014-09-07),rpmfusion仍没有推出centos7/rhel7下的源,所以安装软件是痛苦的事情。

对于缺少yum的软件,我习惯是在 http://rpm.pbone.net/ 上手工查找,然后找最近似改造版的下载。例如在centos下,首选找同版本centos或redhat el包,没有的话找最近似的fedora版本下载,再没有,使用前一版本的centos/rhel包,或者fedora包。

也就是在昨天或者说今天凌晨,在通过 http://rpm.pbone.net/ 手工解决依赖安装smplayer/mplayer 的过程中,发现了这个源,因为有好几个包都是之这个域名下下载的,所以直接访问了一下,竟然是一个yum源,维护者是很积极的。在此表示由衷感谢!

li.nux.ro 上目前有rhel/centos6及7两个版本的rpm/yum源,它需要依赖epel源,所以要首先配置epel源。不过正常情况下大家都会装上epel源的吧,epel是连centos官方都推荐的优质源。

使用说明,很简洁,丝毫不啰嗦,http://li.nux.ro/repos.html

另外,atrpms这个源也是值得推荐的,没有比较这两个源之间的重复度或冲突情况。对于求稳定的朋友,建议安装过需要的软件后,卸载这些第三源,以免造成系统包被替换(或许有这个可能,据说atrpms会替换系统包,毕竟rhel/epel的版本经常太老)

Android无法连上VPN的原因及解决办法(android系统root后连vpn显示已断开)

为了能正常使用google等的网络服务,偶尔要在android上使用pptp vpn,在linode上搭建的。最近使用了cm固件,nightly版,还是比较稳定的。

不过最近经常无法连接vpn,连接N次都是非常慢、然后提示“连接已断开”;起先以为是固件的问题,重刷了几次机,但问题依旧。

今天在外面使用联通3G,突然就不能连vpn了,以为是北京联通的国际出口上被过滤pptp数据了;不能正常上网,很崩溃,很崩溃。回来后在电脑上pptp拨号很顺利,证明电信网络是可以成功拨号。手机已经自动切换为wifi,连了两次vpn,全部失败。于是全面怀疑可能是其它原因。

google查 “android vpn 连接失败”相关文章,其中有root之后vpn无法连接vpn的文章,因为cm固件是天生root的,而刷机后并不是马上就连不了vpn,而是要过一两天之后,因为不太在意,只是草草看了,看过后,回顾最近在无法vpn前的事情,似乎都与使用smartHosts之类的软件修改hosts文件,这个操作是需要root权限的。虽然以前也root,但没有改过hosts;感觉可能有道理。于是到cm自带的文件浏览器,改设置为root模式,到/etc里,修改 mount 为r/w,然后查了里面的文件 /etc/ppp/ip-up-vpn 的权限,还真的没有写权限,修改权限为775,然后再登录vpn,虽然不快,但还是连上了。

其实解决这个问题非常简单:修改文件 /etc/ppp/ip-up-vpn 的权限,至少让root用户可写。使用你自己熟悉的工具,如re浏览器,固件工具箱等太多了。如果对linux文件权限不太了解,请参看文后链接。

很多朋友为了获取更多的自由,将自己的Android 手机破解获取root权限了,不过获取root后有一个问题,无法再正常连上VPN(即使设置完全正确),经过网上查找相关资料,确认是因为/etc/ppp/ip-up-vpn 的权限问题所致。

参考文章:http://www.ruan8.com/tutorial_1128.html

 

极简单/简陋的wordpress插件:网站访客追踪记录 v0.0.2

这是对旧文中提到的wordpress访客记录的一次升级版,照样很简陋,算作给自己玩的吧;谁需要的话,也可以拿去玩。

源码

<?php
/*
Plugin Name: fs trace
Plugin URI: http://blog.path8.net/
Description: This plugin will trace all visitor's visit action.
Version: 0.0.2
Author: fengyqf
Author URI: http://blog.path8.net/
*/

/*  
    Copyright 2008  fengyqf  (email : fengyqf@gmail.com)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

function fstrace_by_fengyqf(){
  global $wpdb;

  $url=mysql_escape_string(substr($_SERVER["REQUEST_URI"],0,200));
  $referer=mysql_escape_string(substr($_SERVER["HTTP_REFERER"],0,200));
  $cookie=mysql_escape_string(substr($_SERVER["HTTP_COOKIE"],0,250));
  $client=mysql_escape_string(substr($_SERVER["HTTP_USER_AGENT"],0,200));
  if(getenv('HTTP_CLIENT_IP')) {
    $ip = getenv('HTTP_CLIENT_IP');
  } elseif(getenv('HTTP_X_FORWARDED_FOR')) {
    $ip = getenv('HTTP_X_FORWARDED_FOR');
  } elseif(getenv('REMOTE_ADDR')) {
    $ip = getenv('REMOTE_ADDR');
  } else {
    $ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
  } 
  $ip=mysql_escape_string(substr($ip,0,16));
  $sql="insert into `log`.`wp_trace_{$wpdb->prefix}`(`referer`,`url`,`unixtime`,`ip`,`client`,`cookie`) 
          values('{$referer}','{$url}',".time().",'{$ip}','{$client}','{$cookie}')";
  $wpdb->query($sql);
  if($wpdb->last_error){
    echo "<script type=\"text/javascript\">alert('Something Wrong! get messages at page bottom. | 出错了,到页底查看详细');</script><h1>fs trace message</h1><p>You Need to Create a table for <strong>fs trace</strong>, to log your visitor active. this table was in database <i>log</i>, you can change the wp-plugin <strong>fs trace</strong> file, in wp pannel - plugins - edit - fs trace, find the line \"  \$sql=\"insert into `log`.`wp_trace_{$wpdb->prefix}`... \", and change it to <pre>\$sql=\"insert into `wp_trace_{$wpdb->prefix}`...</pre> (yes, delete <i>`log`.</i>),and sava it </p>
<p>您需要创建一个表,用于 <strong>fs trace</strong>存储wordpress的将追踪记录. 该表默认位于数据库 log 中。如果您不方便创建一个名为log的数据库,可以将该表放在当前数据库中,只是要修改一下<strong>fs trace</strong>源码了,到wordpress仪表盘 - 插件 - 编辑 - fs trace, 找到这样一行  \"  \$sql=\"insert into `log`.`wp_trace_{$wpdb->prefix}`... \", 改成 <pre>\"insert into `wp_trace_{$wpdb->prefix}`...</pre> (就是删除 <i>`log`.</i>),保存。 </p>
<p>create the table as below/建表语句如下</p>
<pre>use `log`; 
CREATE TABLE `wp_trace_{$wpdb->prefix}` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `referer` varchar(200) NOT NULL DEFAULT '',
  `url` varchar(200) NOT NULL DEFAULT '',
  `unixtime` int(10) unsigned NOT NULL DEFAULT '0',
  `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `ip` varchar(16) NOT NULL DEFAULT '',
  `client` varchar(200) NOT NULL DEFAULT '',
  `cookie` varchar(250) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;</pre> <p>grant the mysql user INSERT privileges at least;In fact, INSERT is enough. </p> <p>为 mysql 用户赋权限,至少需要对该表的INSERT权限;事实上只需要insert权限即可. </p> <p> Alert by the plugin <strong>fs trace</strong> </p>";
//    var_dump($wpdb);
  }
}
add_action('wp_footer','fstrace_by_fengyqf');
?>

下载源码

使用说明

wordpress后台,通过上传zip文件方式上传该插件,(或解压后,连目录上传到wordpress下 wp-content/plugins/ 目录),启用插件,然后到打开前台任意页面,照错误提示操作。消息提示有中英两种语言。提示文字可能因为您的模板关系而排版错乱,看起来有些费力。

本插件不会自己创建数据表,需要您按消息提示手工创建。

本表默认在一个名为log的数据库里,因为追踪表通常会比较大,可以减少wordpress主数据库体积,主要是方便备份。单独。如果不方便创建这个数据库(如在虚拟主机上,主机商通常只给一个数据库),可以修改本插件源码,上述错误消息里也有提示。

国内开启google位置记录功能/android版google maps 7+上,恢复位置记录功能在国内使用(需root)

android版google 地图在 7以后的版本上,位置记录功能在国内不能用了,提示本功能不能在中国使用。

至少对本人,“位置记录”功能是非常有用的功能,尤其是骑车出行时记录自己的路线。目前还没找到替代产品。之前一段时间内恢复回旧版本,以使用该功能。后来使用shlug用户组的高手kernel老兄提供的方案,成功启用了本功能。

方法如下:

让andorid系统启动后加载下面这段脚本:

脚本fixsim

欺骗android系统,让它以为运行在美国运营商的服务下。

加载该脚本需要手机有root权限。个人使用 “固件工具箱” (rom toolbox) 实现启动加载,功能位于:

rom toolbox - 工具 - 脚本编写器 , 导入如上启用脚本(推荐将脚本改下名字,如init.fixsim.sh),并设置成开机自动启动,完成后重启手机。

Screenshot_2013-10-22-23-01-06 Screenshot_2013-10-22-23-01-20

可能得过一阵子才能在google地图里启用“位置记录”,估计是系统缓存的问题。

个人测试环境:galaxy nexus 手机, android 4.3(已root), 固件工具箱5.9.0 付费版,上述脚本。

----------------------------

当然用其它办法让该脚本执行也可以,个人没有尝试。kernel老兄的方案是:将上述脚本“自己扔 /etc/init.d/下面,记得改权限,当然内核得支持执行/etc/init.d下面的脚本才行”

-----------------------------

另外:7以后版本的google地图上,有个很好用的缩放地图的方法,只要单指即可完美操作,比传统的缩放按钮更好用,比多指拉伸/缩小更方便:

从某主机商的虚拟主机上拷出来的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>

在centos 6.x 上成功安装 kchmviewer

使用centos 6 做桌面用,但一直有个缺陷:kchmviewer安装不上。提示缺少Qt库,以前通过rpm.pbone.net查找下载qt库,但总是有包依赖的冲突,两个软件包(具体是谁忘记了),一个要高版本的库,一个一定要低版本的库,于是放弃,尝试自己编译,一样没解决包依赖问题。

今天是2012年元旦,随手google搜索一下 centos 6 kchmviewer,是看到了第一条结果,马上尝试,很顺利,安装成功。

回看一下自己失败的原因,原来是下载的qtwebkit包太新(qtwebkit-2.1.1-1.el6.i686),所以出现软件包依赖冲突;而使用qtwebkit-2.0-3.el6.i686.rpm就可以成功安装了。

centos 6.x 上安装 kchmviewer两个包如下

kchmviewer-5.3-1.i586.rpm

qtwebkit-2.0-3.el6.i686.rpm (http://pkgs.org/centos-6-rhel-6/atrpms-i386/qtwebkit-2.0-3.el6.i686.rpm/download/)

 

参考

http://www.myzhenai.com/thread-14387-1-1.html (CentOS6.0安装kchmviewer)

ssh + autoproxy(firefox插件) 跨栏安全访问网络

首先要有ssh账号,当然为了跨栏必须要用国外的ssh账号,这 里假定已经有国外ssh账号。

下载软件Tunnelier 安装(或解压缩),得到以下文件,运行其中的 Tunnelier.exe

如下图示中,login 选项卡里,输入Host(主机IP地址或域名都可),Username端口填写ssh账号用户名,Initial methord选择password,Password填写ssh账号密码。

切换到Otions选项卡, 取消如下的 Open Terminal 与 Open SFTP.

切换到Services选项卡, 勾选如下socks/http proxy forwarding下的 Enabled, Listen Port(本地监听端口)改为7070 (不改也可以,但在使用时要相应改为这里设定的端口)

点Login按钮登录ssh服务器。

第一次登录时,会出现密钥保存提示,如下,点 Accept and Save。

消息提示框里看到如下图或线处所示,即ssh转发通道建立完成。

接下来就可以在浏览器中设置代理,推荐使用firefox+autoproxy(理论上IE也可以,未实际测试)

firefox中安装autoproxy插件。

受限网站的访问方法

重要提示:

仅限公司内部使用,不对外传播,不得用于非法目的

非必需情况下,不要使用“全局模式”!(文中有说明)

非必需情况下,绝对不允许看YouTubo等大流量的受限网站

使用firefox浏览器

点菜单栏上 工具 – 附加组件

搜索 autoproxy

点“添加到Firefox(A)…”,稍后出现如下

倒计时完毕后,点立即安装

安装完成后点“重新启动Firefox”;重新启动完成后如下

关掉“附加组件”对话框

勾选如上图中的gfwList(P.R.China),点确定。

点菜单栏上 工具 – 附加组件

点”Autoproxy 0.4b2.xxx “的”选项”,打开如下的“AutoProxy 首选项”

如上的弹出窗口菜单栏 – 代理服务器 – 编辑代理服务器

注意其中所示的 ssh –D一行,这里7070即是使用tunnelier里面的本地端口号。

(其它项目不需要用做任何修改;如有兴趣可私下研究),确定

点“AutoProxy 首选项”对话框菜单栏 – 代理服务器 – 选择代理服务器

把“默认代理”修改为 “ssh –D” (如图),确定。

点“AutoProxy 首选项”对话框菜单栏 – 选项

保持 “自动模式”被选中(前带黑点)、”在状态栏显示”被选中(前带勾号)

点“AutoProxy 首选项”对话框的“确定”关闭之。

关闭“附加组件”对话框。

Firefox浏览器的右下角将有一个红色的“福”字图标,请打开 “脸书网”http://www.facebook.com/ 测试能否打开。

点击Firefox右下角的“福”字图标,可以切换代理模式,它有三种模式:

红色:自动模式 - firefox将自动对需要翻墙的网站使用代理。

绿色:全局模式 - firefox将对所有网站使用代理,此时访问国内网站将会非常慢。

灰色:禁用模式 – 对所有网站都不使用代理。

一般情况下请保持它为红色。

至此设置完毕,您的firefox已经是最智能的翻墙利器。

Autoproxy还有更多功能,可自行研究;不过按上述所设置已经足够对付绝大多数需求。

注意:

1. 一般不要使用“全局模式”!

常见问题

1 如果firefox出现如下所示的“代理服务器拒绝连接”:

请检查默认代理是否是ssh –D,条目里的配置是否正确。

再请检查tunnelier是否启动并成功连接到远程服务器。

悲剧,狗爹虚拟主机的ssh禁用转发了

悲剧了

悲剧,狗爹虚拟主机的ssh -d禁用转发了,快十一了,网络质量非常不好,博客后台半天都没有打开完成,就在标题里写内容了。

文章发布出去,页面终于可以打开完成了,补几句。

突然发现ssh不能翻墙了,查看进程是正常的,杀死自动重新运行,修改配置重启手动运行,照样没用,网查看错误消息

channel 1: open failed: administratively prohibited: open failed
channel 2: open failed: administratively prohibited: open failed

有中文资料,有几个原因,其中一个是最不愿意看到的原因,服务器端禁止转发了,然而经过加-v参数,看详细消息,越来越像这个原因,ssh登录到服务器上查看sshd相关的几个参数,

-bash-3.2$ less /etc/sysctl.conf |grep ip_for
net.ipv4.ip_forward = 0

果然操作系统级禁用转发

-bash-3.2$ cat /etc/ssh/sshd_config

文件最后一行

AllowTcpForwarding no
看来似乎是管理员刚加的这个参数。不过uptime显示系统启动17天了,难道这个设置还是修改后不重启就生效的?sshd的可以修改后重启服务立刻生效,但sysctl.conf级的呢?或许是管理员只是修改了这个设置,并没有重启机器。

最不愿意看到原因。

看来要买个vps,或者买个专门用于ssh转发的账号

firefox6.x上使用google工具栏

firefox6正式版已经发布,插件一般总是要滞后几天;不过这次,google工具栏比较悲剧,官方不支持firefox6了,很可恶。

以前修改插件里的文件而在插件升级版发布前、在新版本firefox里使用,对google工具栏如法炮制,果然还是有效的。

方法如下:

修改文件

/home/[user-main-folder]/.mozilla/firefox/lxyp34or.default/extensions/{3112ca9c-de6d-4884-a869-9855de68056c}/install.rdf

windows下,应该在X:\Documents and Settings\[user-main-folder]\Application Data\Mozilla\Firefox\Profiles\esx4b5b6.default\extensions\xxxx\install.rdf

第17行,把        <em:maxVersion>4.0.*</em:maxVersion>

改成

<em:maxVersion>7.0.*</em:maxVersion>

即可。才发现使用firefox 5时就修改过这个值了,不过当时改成了5,这次改成7,下次fx升级就不用改了。

linux下ssh -D 转发脚本/ssh断线后自动重连

ssh转发ssh -D的作用就不说了,相信看到这篇文章的童鞋们应该都......[此处略去N个字]。

有不少ssh服务器会定期踢除不活动的连接,尤其像我这样使用 "ssh -D " + autoproxy,通常访问的网站都是没有被有被墙的,于是ssh长时间不活动,于是被服务器踢了。写一个简单脚本,解决这一问题。

前提:

有ssh服务器账号密码,并设置好免密码登录ssh.

思路:

写脚定期查看ssh进程是否已经退出,如果退出则重新连接ssh。

设置一个命令别名alias,以一个简单的别名运行这一脚本。

实施:

在~/.bashrc 追加一行

alias fkgxx='sh ~/script/fkgxx &'

以下代码保存为 ~/script/fkgxx

#!/bin/bash

while [ '' == '' ]
do
	ssh_d_process_num=`ps aux|grep -E 'ssh \-' |grep -v grep |wc -l`
	#echo 'ssh_d_process_num:'$ssh_d_process_num
	if [ "$ssh_d_process_num" == "0" ]; then
	#	echo 'ssh -d terminaled'
		/usr/bin/ssh -D :7070 -N fengyqf@path8.net &
	#else
	#	echo 'ssh -d running'
	fi

	sleep 5
done

用法:

开启命令行终端,执行fkgxx,即可;当然设置成登录后自动运行也可以。

不足:

简单的根据进程判断ssh转发进程状态,这并不完善,因为有时该进程可能成为僵死进程,最好再加个检查7070端口是否在正常监听。

PS:

还可以使用autossh实现自动连接功能,可能这是个更好的方案;这里只是个另一个选择,另一个折腾的方法,追求自由精神的选择。