Jul 09

通过SSH远程操作Linux的好工具:Putty用于远程操作linux, Psftp用于远程上传下载。

官方网站:http://www.chiark.greenend.org.uk/~sgtatham/putty/

官方使用说明:http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter6.html

1.启动Psftp
在Windows命令提示符中输入
set PATH=C:psftp.exe所在路径;%PATH%
Psftp登录服务器:

psftp username(at)server.example.com

也可以直接双击运行psftp.exe,命令提示符中出现以下信息:

psftp: no hostname specified; use "open host.name" to connect
psftp>

这时用open命令登录服务器:

open username(at)server.example.com

2.Psftp
2.1 文件名中有空格时使用双引号
如”space name.txt”

2.2 使用通配符
* 代替任何字串
? 替代一个字母
[abc] 在a b c范围内替代一个字母
[a-z] 在a到z范围内替代一个字母
[^abc] 替代一个字母,不包括a b cmatches a single character that is not a, b, or c.
[-a] 代表连接号(-)
[a^] 代表脱字符号(^)
放在上面的所有通配符之前,以取消其(通配符)涵义
(文件夹名称不支持通配符)

2.3 open, quit, close, help命令
quit是关闭Psftp(bey和exit与quit相同),close是切断连接但不关闭PSFTP。

2.4 cd, pwd, lcd, lpwd命令
cd和pwd不用介绍了,lcd和lpwd是在cd和pwd前加了Local,就是本地机器的改变路径和显示路径。也可以用!cd, !pwd来实现lcd, lpwd。

2.5 get, put命令
代表下载和上传。

get something.txt
get something.txt another.txt

上面的代码第一行代表下载something.txt,第二行代表下载something.txt,并重命名为another.txt。上传以此类推

put something.txt
put something.txt another.txt

如果是下载上传文件夹,加上那个递归符号 -r

get -r mydir newname
put -r mydir newname

2.6 mget, mput, reget,reput命令
可以理解为Multiple get, Multiple put,用来一次下载或上传多个文件和文件夹。除了不可以重命名文件或文件夹,其它参数和get, put一样。
re是resume的简写,那么它们就是续传命令了。

2.7 dir, del, mkdir rmdir命令
dir就是ls;del是rm,但不可以删除文件夹;mkdir还是原来的意思(建立文件夹);rmdir是删除文件夹(某些服务器不允许删除非空文件夹,得现删除其中的文件才行)。

2.8 chmod命令
其参数u, g, o, a, +, -, r, w, x涵义分别是:
u (the owning user)文档所有者
g (members of the owning group)组成员
o (everybody else – ‘others’)其它所有人
a (‘all’, everyone)所有人
+ 加上(授予)
– 减去(剥夺)
r (permission to read the file)读
w (permission to write to the file)写
x (permission to execute the file)运行

chmod go-rwx,u+w privatefile

上面代码的涵义是剥夺组成员及其它任何人的读写运行权限,授予文件所有者写权限也(也就是私人文档)

chmod a+r public*

上面代码的涵义授予所有人读权限(也就是公开公开公开)
直接用权限数字代码也可以

chmod 640 groupfile1 groupfile2

2.9 mv命令
如果使用mv是更改文件或文件夹名称,也可以使用ren, rename命令。

2.10 !命令
在上面的命令前加上叹号!,则在本地机器操作。

转自:http://live.haliluya.org/weblog/2007/07/25/psftp/

Jul 07

前几天弄了一个免费的VPS来玩,128M的基本的配置,用来安装其他的软件由于优化不会,可能不能很好的运行,正好有一个博客是建在OpenShift上的,可以用Nginx来做一下反向代理,我Ping了一下,速度不是很快,仅限于可以访问,在配置完成后在电脑上实际测试,速度还是可以的,有总比没有强的。

现在VPS上用apt-get安装Nginx,然后在下载源文件进行编译安装,这样做的好处是在编译的时候不用指定某些路径,实际上我就不会指定路径,路径不对的话很容易造成在系统里不能正常启动。安装上面的方法相当于将原有的安装文件稍稍更新了一下而已。具体步骤如下:

1.下载zlib

wget http://zlib.net/zlib-1.2.7.tar.gz
tar -zxvf zlib-1.2.7.tar.gz

2.下载pcre

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
tar -zxvf pcre-8.30.tar.gz

3.下载nginx

wget http://nginx.org/download/nginx-1.2.2.tar.gz
tar -zxvf nginx-1.2.2.tar.gz

4.安装nginx

cd nginx-1.2.2
./configure --with-http_sub_module --with-pcre=../pcre-8.30 --with-zlib=../zlib-1.2.7
make
make install

5.配置nginx.conf

    #proxy_set_header Host $host;
    #proxy_set_header X-Real-IP $remote_addr;
    #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    client_max_body_size 10m;
    client_body_buffer_size 128k;
    client_header_buffer_size 64k;
    proxy_connect_timeout 90;
    proxy_send_timeout 90;
    proxy_read_timeout 90;
    proxy_buffer_size 16k;
    proxy_buffers 32 16k;
    proxy_busy_buffers_size 64k;

server {
    listen   94.249.183.187:80; ## listen for ipv4
    #listen   [::]:80 default ipv6only=on; ## listen for ipv6
    server_name  rh.chunchu.org;
location / {
    proxy_set_header  X-Real-IP  $remote_addr;
    proxy_set_header  Accept-Encoding "";
    proxy_pass http://redhat.chunchu.org;
    sub_filter redhat.chunchu.org rh.chunchu.org;
    sub_filter_once off;
    proxy_redirect off;
}
}

用vi打开/etc/nginx/文件夹的下文件nginx.conf,在http代码后面输入上述代码后保存推出。

6.重启nginx
以root身份输入命令:

/etc/init.d/nginx restart

7.另附Google GHS反向代理的配置文件
在nginx.conf文件中添加代码:

upstream ghs {
    ip_hash;
    server ghs.google.com;
    server 72.14.203.121;
    server 72.14.207.121;
    server 74.125.43.121;
    server 74.125.47.121;
    server 74.125.53.121;
    server 74.125.77.121;
    server 74.125.93.121;
    server 74.125.95.121;
    server 74.125.113.121;
    server 216.239.32.21;
    server 216.239.34.21;
    server 216.239.36.21;
    server 216.239.38.21;
}

server {
    listen   94.249.243.220:80; ## listen for ipv4
    #listen   [::]:80 default ipv6only=on; ## listen for ipv6
    server_name  ghs.chunchu.org;
location / { 
    proxy_redirect off;
    #proxy_set_header Host $host;
    proxy_pass http://ghs;
    proxy_set_header  X-Real-IP  $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

然后重启nginx即可。

8.注意事项
(1).新安装nginx后,启动nginx一般是不成功的,因为Apache将80端口占用了,须将占用80端口的进程全部Kill,然后再启动nginx就行了。

(2).在编译nginx时,不要忘记添加–with-http_sub_module参数,因为添加这个参数时,反向代理的网站的主页是正常的,但是点击链接后会跳转到原网站的地址,添加–with-http_sub_module参数,然后按照上述示例修改就可以解决这个问题。

(3).我曾试图将网页的反向代理和Google GHS的反向代理合二为一,但是实践了一次都不能成功,都只能是其中的一种成功,二者不能并存,不知奥是我设置的问题还是二者根本就不能同时使用。

(4).在添加proxy_pass http://redhat.chunchu.org;时,如果网址后面没有“/”则表示是相对链接,有”/”则表示是绝对链接,这个有时候也会出现问题。另外要仔细检查配置文件,不要丢失了最后的分号“;”。

Jul 07

初中英语教材封面,前段时间在网上找到的,贴出来留作纪念。

Jul 07

自从启用了Google Page加速,我的博客的SEO的得分就上升的很快,以前都是70分左右,现在都上升到99,100分是没有希望的,99算是所能达到的最高分数吧。

Jul 02

看到cnbeta上有一篇别人投递的文章,总结的是中国大陆的开源镜像的汇总,介绍的都是一些大站,但是我总感觉还有某些常用的没有总结进去,想等有时间慢慢补充一下,先将一些手边的放在这里,到时候看到了再慢慢添加进来。

网易开源镜像站:
http://mirrors.163.com/

搜狐开源镜像站:
http://mirrors.sohu.com/

北京理工大学:
http://mirror.bit.edu.cn (IPv4 only)
http://mirror.bit6.edu.cn (IPv6 only)

北京交通大学:
http://mirror.bjtu.edu.cn (IPv4 only)
http://mirror6.bjtu.edu.cn (IPv6 only)
http://debian.bjtu.edu.cn (IPv4+IPv6)

兰州大学:
http://mirror.lzu.edu.cn/

厦门大学:
http://mirrors.xmu.edu.cn/

上海交通大学:
http://ftp.sjtu.edu.cn/ (IPv4 only)
http://ftp6.sjtu.edu.cn (IPv6 only)

清华大学:
http://mirrors.tuna.tsinghua.edu.cn/ (IPv4+IPv6)
http://mirrors.6.tuna.tsinghua.edu.cn/ (IPv6 only)
http://mirrors.4.tuna.tsinghua.edu.cn/ (IPv4 only)

天津大学:
http://mirror.tju.edu.cn/

中国科学技术大学:
http://mirrors.ustc.edu.cn/ (IPv4+IPv6)
http://mirrors4.ustc.edu.cn/
http://mirrors6.ustc.edu.cn/

西南大学:
http://linux.swu.edu.cn/swudownload/Distributions/

东北大学:
http://mirror.neu.edu.cn/ (IPv4 only)
http://mirror.neu6.edu.cn/ (IPv6 only)

电子科技大学:
http://ubuntu.uestc.edu.cn/

青岛大学:
http://mirror.qdu.edu.cn/

台湾镜像站:
http://www.mirror.tw/pub/

kernel 镜像站:
http://mirrors.kernel.org/

Fedora 官方镜像站:
http://download.fedora.redhat.com/pub
http://download.fedora.redhat.com/

Debian 全球镜像站:
http://www.debian.org/mirror/list

Ubuntu 官方镜像站:
http://releases.ubuntu.com/releases/
http://cdimage.ubuntu.com/

SUSE官方镜像站:
http://download.opensuse.org/

开源世界镜像服务器:
http://mirror.lupaworld.com/

其它镜像站:
http://ftp.chg.ru/
http://ftp.kddilabs.jp/
http://ftp.jaist.ac.jp/pub/
http://ftp.kaist.ac.kr/
http://mirror.karneval.cz/pub/
http://ftp.gwdg.de/pub/
http://ftp.estpak.ee/pub/