2012年1月19日星期四

Yes, You Can Run 18 Static Sites on a 64MB Link-1 VPS


One thing I hated about WebHostingTalk is how much bad advice the so-called “professionals” are giving out to the world. Some poor college student asked in the VPS forums whether he is able to run 18 static HTML sites onVPSLink.com Link-1 plan (64MB RAM, 2.5GB storage & 100GB/month data), and the typical responses are:
“I do not believe you can host 18 websites on 64MB of RAM. I’d bump that up to at least 128 or 256.” –nexbyte
“I really wouldn’t advise anything lower than 265MB RAM for website hosting.” –RikeMedia
(Well, there are some more optimistic comments but I mainly list out those “with things to sell”)
So, just trying to prove the point that yes, 64MB is more than enough to host 18 static sites, I decided to add aLink-1 Xen to my account and document the process. Btw, thanks to Dan @ VPSLink for getting my billing issue resolved :) You can get 10% recursive discount here, or 66% off for the first 3 months here.

Setting Up the VPS

After my order has been provisioned, I re-image the server with a Debian 5 “Lenny” image. I normally pick Debian or Ubuntu because apt-get uses much less memory than RedHat/Fedora’s equivalent, and it’s also my personal preference. I named my new VPS “endor” as I usually just name my boxes after Star Wars systems. Re-imaging a VPS is pretty fast — 2 minutes later I have my root password sent to my email address so I can ssh in to set up the new system.
$ ssh root@endor
root@endor's password:
Linux 66671 2.6.18-53.1.13.el5xen #1 SMP Tue Feb 12 14:04:18 EST 2008 i686

endor:~# free
             total       used       free     shared    buffers     cached
Mem:         65704      64008       1696          0       5616      44100
-/+ buffers/cache:      14292      51412
Swap:       131064          0     131064
endor:~# cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 15
model name      : Intel(R) Core(TM)2 Duo CPU     E4500  @ 2.20GHz
stepping        : 13
cpu MHz         : 2194.496
cache size      : 2048 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 10
wp              : yes
flags           : fpu tsc msr pae mce cx8 apic mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc up pni monitor ds_cpl est tm2 cx16 xtpr lahf_lm
bogomips        : 5558.81
Plenty of free memory and a single core of C2Duo E4500 — although not a high-end Xeon CPU, but should be more than sufficient to do what we need it to do. The next thing I want to do is to make sure every package is up to date.
endor:~# apt-get update && apt-get upgrade
Get:1 http://debrepo.mirror.vpslink.com lenny Release.gpg [386B]
Get:2 http://debrepo.mirror.vpslink.com lenny Release [63.2kB]
Get:3 http://debrepo.mirror.vpslink.com lenny/main Packages [5295kB]
Get:4 http://security.debian.org lenny/updates Release.gpg [197B]
Get:5 http://security.debian.org lenny/updates Release [40.8kB]
Get:6 http://debrepo.mirror.vpslink.com lenny/contrib Packages [76.1kB]
Ign http://security.debian.org lenny/updates/main Packages/DiffIndex
Get:7 http://security.debian.org lenny/updates/contrib Packages [14B]
Get:8 http://security.debian.org lenny/updates/main Packages [50.6kB]
Fetched 5526kB in 4s (1330kB/s)
Reading package lists... Done
...

Setting Up Web Server

Okay. The 64MB VPS is now up and running. What should we do next? Installing a web server of course, so we can start serving our static pages! Which web server? Definitely not Apache as it would be a waste of valuable memory here. Again my personal favourite is Nginx (pronounces Engine X), which currently powers LowEndBox.com. However, in this exercise I will go for Lighttpd because I found it easier to set up for abitary sites.
First of all — get Lighttpd installed.
endor:~# apt-get install lighttpd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
...
Setting up libterm-readkey-perl (2.30-4) ...
Setting up libterm-readline-perl-perl (1.0302-1) ...
Setting up lighttpd (1.4.19-5) ...
Starting web server: lighttpd.
endor:~# ps -u www-data u
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
www-data  1690  0.0  1.5   5416  1008 ?        S    07:17   0:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
Plain vanilla stripped down and un-configured 32 bit Lighttpd sits around 1MB RSS — not bad.
Next, we need to get our websites up there and point Lighttpd to them. It’s a good idea to put the web sites in an organised structure inside the file system. I usually just place them this way:
  • /var/www/<hostname>/html
So if I have an HTML file at http://www.example.com/testing.html, it will sit on the file system at/var/www/www.example.com/html/testing.html. Unfortunately I do not have 18 static sites. For testing purpose I am only going to display a very basic HTML page at http://test.lowendbox.com/.
endor:~# mkdir -p /var/www/test.lowendbox.com/html
endor:~# echo '<h1>Low End Box Rocks!</h1>' > /var/www/test.lowendbox.com/html/index.html
So now our “website” is ready — how does Lighttpd, our webserver, knows where to find the files corresponding to the website? That’s where Lighttpd’s mod_simple_vhost comes in handy.
endor:~# lighttpd-enable-mod simple-vhost
Available modules: auth cgi fastcgi proxy rrdtool simple-vhost ssi ssl status userdir
Already enabled modules:
Enabling simple-vhost: ok
Run /etc/init.d/lighttpd force-reload to enable changes
endor:~# /etc/init.d/lighttpd force-reload
Stopping web server: lighttpd.
Starting web server: lighttpd.
Now navigate to test.lowendbox.com (which already has an A record to my new VPS’s IP address) — here we have it! Low End Box Rocks!!!
Prerequisite:
You must be already familiar with DNS and know how to create records to point to IP addresses. For free DNS hosting I recommend EveryDNS, which has also been hosting LowEndBox’s domain.
You can now basically just dump static files at /var/www/<hostname>/html, with <hostname> resolved to your VPS’s IP address, and you will have your static websites over there in no time. You do not even need to tell Lighttpd to reload, as mod_simple_vhost automatically maps the hostname to appropriate file name. Repeat it 18 times and problem solved!
At 1 single testing site with no traffic, Lighttpd sits at around 1.5MB RSS, although I doubt it would increase significantly when you increase the number of sites or the traffic. Lighttpd and Nginx are single-threaded poll-based asynchronised web servers so for static file serving, the bottle-neck would be disk/network IO rather than amount of memory or CPU performance.
There are still lots of memory left. Maybe we can have some fun.

Installing WordPress

So you think, “hey Low End Box rocks and it runs on WordPress. So maybe I will have that installed as well!” Wow. But WordPress is a content management system for creating dynamic websites! It simply cannot be possible on a 64MB VPS, the WHT crowd says! Grrr!! Let’s give it a try.
To run WordPress from your static-file serving Lighttpd, you need a few more packages — namely MySQL and PHP in CGI/FastCGI mode.
endor:~# apt-get install mysql-server php5-cgi php5-mysql
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
...
Creating config file /etc/php5/cgi/php.ini with new version
Setting up php5-mysql (5.2.6.dfsg.1-1+lenny2) ...
Setting up sgml-base (1.26) ...
Setting up xml-core (0.12) ...
Setting up mailx (1:20071201-3) ...
I know it installs whole lot of other junks but don’t worry — we will live with them first and will try to optimise later. It also requires you to set up the root password for MySQL server, and I conveniently chose the most obscured password in this exercise — “root” (yes, don’t use that because I am already using it as my root password :)
We then need to configure lighttpd to handle PHP files.
endor:~# cat > /etc/lighttpd/conf-enabled/10-cgi-php.conf
server.modules += ("mod_cgi")
cgi.assign = (".php" => "/usr/bin/php5-cgi")^D
endor:~# /etc/init.d/lighttpd force-reload
Stopping web server: lighttpd.
Starting web server: lighttpd.
Done! It should be able to serve PHP files. Just to test it out:
endor:~# echo '<?php phpinfo(); ?>' > /var/www/test.lowendbox.com/html/phpinfo.php
Now navigate to http://test.lowendbox.com/phpinfo.php — you should be able to see the output of phpinfo()function. What we are going to do next is to set up a WordPress blog under http://test.lowendbox.com/blog/. WordPress.org already provides a great tutorial on installing WordPress, but let’s do it step by step on the command prompt.
My plan:
  • Create database “test_blog”
  • Download the latest WordPress and unzip to test.lowendbox.com/blog
  • Set up configuration file and run the WordPress install
  • Update Lighttpd to provide clean URL, aka Pretty Permalinks.
Let’s go!
endor:~# mysqladmin -uroot -proot create test_blog
endor:~# wget http://wordpress.org/latest.tar.gz
Resolving wordpress.org... 72.233.56.138, 72.233.56.139
Connecting to wordpress.org|72.233.56.138|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: `latest.tar.gz'

...

2009-03-17 13:03:15 (1.01 MB/s) - `latest.tar.gz' saved [1624416]

endor:~# tar zxf latest.tar.gz -C /var/www/test.lowendbox.com/html
endor:~# cd /var/www/test.lowendbox.com/html
endor:/var/www/test.lowendbox.com/html# mv wordpress blog
endor:/var/www/test.lowendbox.com/html# mv blog/wp-config-sample.php blog/wp-config.php
endor:/var/www/test.lowendbox.com/html# vi blog/wp-config.php
When you are editing WordPress’ configuration file, set DB_NAME to “test_blog”, DB_USER and DB_PASSWORD to “root” for something quick, dirty and potentially insecure. Here is one final step — navigate to http://test.lowendbox.com/blog/, and WordPress will guide you through the rest of setup.
It is also relatively easy to set up pretty permalinks for WordPress on Lighttpd. In our example,
endor:~# cat > /etc/lighttpd/conf-enabled/lowendbox.conf
$HTTP["host"] == "test.lowendbox.com" {
    $HTTP["url"] =~ "^/blog/" {
        server.error-handler-404 = "/blog/index.php"
    }
}^D
endor:~# /etc/init.d/lighttpd force-reload
Stopping web server: lighttpd.
Starting web server: lighttpd.
That’s it! You can now go into WordPress to configure the desirable Permalink Structure. Do note that the current WordPress dashboard page is very resource intensive, as it fetches development blog, other WP news, incoming links, etc from various sources, concurrently on separate PHP CGI processes. There might be plugins to turn off this server-killing behavior (or just use older version of WordPress like 2.0.x which is still maintained). Likewise some WP caching plugin can be very useful in reducing the load. Google them and you shall find.

Optimisation — Squeeze More Memory!

So now we have a Debian 5 web server box that can handle lots of static sites + a few WordPress blogs, and it fits “fine” on a 64MB Xen VPS. Let’s see what processes are running:
endor:~# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
...
root       325  0.0  0.4   2032   292 ?        S<s  04:25   0:00 udevd --daem
root       879  0.0  0.4   2788   304 ?        Ss   Mar17   0:00 /bin/bash --
root      1216  0.0  0.0      0     0 ?        S    Mar17   0:00 [pdflush]
root      1649  0.0  0.2   3144   188 ?        Ss   Mar17   0:00 /usr/sbin/famd
root      6427  0.0  4.4   8024  2928 ?        Ss   Mar17   0:00 sshd: root@pts/
root      6429  0.0  2.3   2804  1564 pts/0    Ss   Mar17   0:00 -bash
root      6441  0.0  1.8  33092  1200 ?        Sl   Mar17   0:00 /usr/sbin/rsysl
root      6453  0.0  1.4   5284   976 ?        Ss   Mar17   0:00 /usr/sbin/sshd
root      6470  0.0  1.3   2048   896 ?        Ss   Mar17   0:00 /usr/sbin/cron
daemon    6482  0.0  0.8   1772   560 ?        Ss   Mar17   0:00 /sbin/portmap
www-data  6510  0.0  2.6   5848  1736 ?        S    Mar17   0:00 /usr/sbin/light
root      6572  0.0  1.7   2488  1156 pts/0    S    Mar17   0:00 /bin/sh /usr/bi
mysql     6611  0.0 26.2 143652 17228 pts/0    Sl   Mar17   0:00 /usr/sbin/mysql
root      6613  0.0  0.8   1636   536 pts/0    S    Mar17   0:00 logger -p daemo
103       6973  0.0  1.3   6112   908 ?        Ss   Mar17   0:00 /usr/sbin/exim4
root      6986  0.0  1.3   2308   908 pts/0    R+   00:01   0:00 ps aux
endor:~# free
             total       used       free     shared    buffers     cached
Mem:         65704      51424      14280          0        936      22588
-/+ buffers/cache:      27900      37804
Swap:       131064        864     130200
Note that it’s an idle box. The swap is slightly used and at 37MB free it is actually not too bad. Let’s try to squeeze a little bit more memory out from the factory setup.
MySQL is by far the biggest offender, and I have talked about how to reduce MySQL memory usage here. If you are just running simple CMS, InnoDB is probably not required — it uses more memory and a lot heavier on IO as well. We can simply use the LxAdmin’s mysql.cnf which I linked on the other blog post to get the bare-minimum MySQL running.
endor:~# cat > /etc/mysql/conf.d/lowendbox.cnf
[mysqld]
key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K
skip-bdb
skip-innodb^D
As mysqld_safe script uses /bin/sh for scripting, it’s also a good idea to check whether dash is used instead of bash.
endor:~# apt-get install dash
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
...
Unpacking dash (from .../dash_0.5.4-12_i386.deb) ...
Processing triggers for man-db ...
Setting up dash (0.5.4-12) ...
endor:~# dpkg-reconfigure dash
Adding `diversion of /bin/sh to /bin/sh.distrib by dash'
Adding `diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by dash'
endor:~# /etc/init.d/mysql restart
Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld.
Checking for corrupt, not cleanly closed and upgrade needing tables..
One thing I don’t like about Debian 5 is its default inclusion of rsyslog. Well — it’s feature rich, but I don’t need MySQL and TCP syslog support. Weight at 1.2MB RSS is just a bit too fat I reckon. I am not game enough to gowithout a syslog daemon, so I just go for syslog-ng. Probably not the most light weight, but it’s just something I have been using for the last couple of years.
endor:~# ps -C rsyslogd v
  PID TTY      STAT   TIME  MAJFL   TRS   DRS   RSS %MEM COMMAND
 6441 ?        Sl     0:00      0   207 32936  1260  1.9 /usr/sbin/rsyslogd -c3
endor:~# apt-get install syslog-ng && dpkg --purge rsyslog
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
...
Setting up syslog-ng (2.0.9-4.1) ...
Starting system logging: syslog-ng.
(Reading database ... 16517 files and directories currently installed.)
Removing rsyslog ...
Purging configuration files for rsyslog ...
endor:~# ps -C syslog-ng v
  PID TTY      STAT   TIME  MAJFL   TRS   DRS   RSS %MEM COMMAND
 8215 ?        Ss     0:00      0   105  2754   708  1.0 /usr/sbin/syslog-ng -p
Shedding 500kb RSS — not too bad I guess :)
Next — Portmap and FAM got installed when Lighttpd was first installed. Lighttpd does not really need FAM. It’s used for stat cache to reduce seeks, but can live without. Not that I have noticed any performance difference anyway for small traffic anyway. Having both of them removed from the process list would give us extra 750KB.
endor:~# apt-get remove --purge portmap
eading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
...
OpenSSH can be replaced by dropbear to save memory.
endor:~# touch /etc/ssh/sshd_not_to_be_run
endor:~# apt-get install dropbear
...
endor:~# vi /etc/default/dropbear
endor:~# /etc/init.d/dropbear start
Starting Dropbear SSH server: dropbear.
Just remember to set NO_START=0 in /etc/default/dropbear so dropbear can run as a daemon. Dropbear daemon is using around 500KB less than OpenSSH daemon during idle, and for each connection it uses 1.5MB less on this Debian 5 box — that’s quite a saving!
That’s probably it! Vixie cron can be replaced by a light weight DCRON but I can’t seem to be able find it in Debian’s repository. Exim4 is probably one of the most light weight mail daemon you can have, but then again you might want to question — “do I need a mail daemon running”? You can probably bring it down, and just run /usr/sbin/runqonce every 2 hours to process the queue, in case the previous delivery failed. That would probably give you another 1MB to play with.
You can also use PDKSH to replace BASH as interactive shell to loose some weight.
endor:~# ps -C bash v
  PID TTY      STAT   TIME  MAJFL   TRS   DRS   RSS %MEM COMMAND
 8409 pts/1    Ss     0:00      2   663  2140  1568  2.3 -bash
endor:~# apt-get install pdksh
endor:~# chsh -s /bin/pdksh
<log out and then SSH back in>
# ps -C pdksh v
  PID TTY      STAT   TIME  MAJFL   TRS   DRS   RSS %MEM COMMAND
 8550 pts/0    Rs     0:00      0   174  1633   588  0.8 -pdksh
That’s 1 full megabyte off the scale! Also note that VPSLink’s /etc/inittab automatically spawn a BASH process on the console — just in case you got locked out from firewall. For me it’s the last line of inittab file. Change it to /bin/shor /bin/pdksh, run init q to reload init(1), and then kill that bash process.
Here’s the end result:
# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
...
root       325  0.0  0.4   2032   292 ?        S<s  Mar17   0:00 udevd --daem
root      1216  0.0  0.0      0     0 ?        S    Mar17   0:00 [pdflush]
root      6470  0.0  1.3   2048   896 ?        Ss   Mar17   0:00 /usr/sbin/cron
103       6973  0.0  1.3   6112   912 ?        Ss   Mar17   0:00 /usr/sbin/exim4
root      7953  0.0  0.7   1716   524 ?        S    00:23   0:00 /bin/sh /usr/bi
mysql     7992  0.0  8.2  37904  5404 ?        Sl   00:23   0:00 /usr/sbin/mysql
root      7994  0.0  0.8   1636   536 ?        S    00:23   0:00 logger -p daemo
root      8215  0.0  1.1   2860   776 ?        Ss   00:31   0:00 /usr/sbin/syslo
www-data  8313  0.0  2.4   5712  1640 ?        S    00:37   0:00 /usr/sbin/light
root      8418  0.0  0.7   2052   468 ?        Ss   00:51   0:00 /usr/sbin/dropb
root      8527  0.0  0.7   1712   468 ?        Ss   01:19   0:00 /bin/sh --
root      8549  0.0  1.9   2712  1300 ?        Ss   01:21   0:00 /usr/sbin/dropb
root      8550  0.0  0.9   1808   600 pts/0    Rs   01:21   0:00 -pdksh
root      8562  0.0  1.3   2308   908 pts/0    R+   01:26   0:00 ps aux
# free
             total       used       free     shared    buffers     cached
Mem:         65704      58852       6852          0       2180      40344
-/+ buffers/cache:      16328      49376
Swap:       131064        380     130684
That’s 12MB trimmed, which can be used in disk cache to improve static file serving.

Conclusion

So how do we conclude? 64MB is more than enough to serve a few low traffic static websites. You can actually run a few WordPress sites with a few hundred visitors a day — at the price equivalent to many heavily oversold shared hosting and you get root access!
One thing about root access though — in all my examples above I used root account and never bothered to use anormal user account. It is bad from security aspect so don’t do it. Or at least don’t tell anyone that you use nothing but root :)

2012年1月13日星期五

Chrome与DNSmasq的合体,让你更爽快的使用Google

Chrome与DNSmasq的合体,让你更爽快的使用Google:

喜欢使用Google搜索的人都懂得,在天朝使用Google是多么痛苦的一件事,不仅有着一大串的敏感词,还会时不时的抽风。好在现在Google已经全面启用了HTTPS,可以抵御关键词过滤,但是抽风的问题如何解决?

网友的力量总是无穷无尽的,有人在GoogleCode上创建了Smarthosts项目,通过本地的域名解析来应对DNS污染的问题,不仅更新维护频率高,更是推出了各种各样的版本,其中就包括DNSmasq的版本。项目地址在这里:http://l4.si/VuC


小科普:关于Hosts、Dnsmasq

Hosts是一个没有扩展名的系统文件,可以用记事本等工具打开,其作用就是将一些常用的网址域名与其对应的IP地址建立一个关联“数据库”,当用户在浏览器中输入一个需要登录的网址时,系统会首先自动从Hosts文件中寻找对应的IP地址,一旦找到,系统会立即打开对应网页,如果没有找到,则系统再会将网址提交DNS域名解析服务器进行IP地址的解析。

DNSmasq是一个小巧且方便的用于配置DNS和DHCP的工具,适用于小型网络,它提供了DNS功能和可选择的DHCP功能。它服务那些只在本地适用的域名,这些域名是不会在全球的DNS服务器中出现的。并且DNSmasq被广泛应用在路由器的第三方固件上(如大名鼎鼎的DD-WRT与Tomato)。


若您的路由器不支持DNSmasq或者根本不使用路由器,可以直接向下跳到Hosts部分。


DNSmasq相对于Hosts的优势就在于DNSmasq支持泛域名的解析。例如abc.domain.com与domain.com要同时指向127.0.0.1,若使用Hosts就需要分别为abc.domain.com、domain.com设置解析地址,而DNSmasq只需要指定domain.com。这样的特点使得DNSmasq的列表更加简洁与便于维护。并且同一局域网内的设备都能同步更新域名解析信息。


进入到路由器的DNSmasq设置页面,以Tomato为例:

tomatoDNSmasq.png

在自定义设置中填入如下规则


#Google Start
server=/android.clients.google.com/8.8.4.4
server=/mtalk.google.com/8.8.4.4
server=/talk.google.com/8.8.4.4
server=/reader.googleusercontent.com/8.8.4.4
address=/talkx.l.google.com/203.208.46.180
address=/talkgadget.google.com/203.208.46.180
address=/www.google.com/203.208.46.180
address=/music.google.com/203.208.46.180
address=/music.googleusercontent.com/203.208.46.180
address=/music-streaming.l.google.com/203.208.46.180
address=/large-uploads.l.google.com/203.208.46.180
address=/uploadsj.clients.google.com/203.208.46.180
address=/t.doc-0-0-sj.sj.googleusercontent.com/203.208.46.180
address=/google.cn/203.208.45.208
address=/google.com/203.208.45.208
address=/google.com.hk/203.208.45.208
address=/googlehosted.com/203.208.45.208
address=/android.com/203.208.45.208
address=/google-analytics.com/203.208.45.208
address=/gstatic.com/203.208.45.208
address=/youtube.com/203.208.45.206
address=/ytimg.com/203.208.45.208
address=/google.com.hk/203.208.45.208
address=/ggpht.com/203.208.45.208
address=/googleusercontent.com/203.208.45.208
address=/appspot.com/203.208.45.208
address=/googlevideo.com/203.208.45.208
address=/googlecode.com/203.208.45.208
address=/gvt0.cn/203.208.45.208
address=/gvt0.com/203.208.45.208
address=/googleapis.com/203.208.45.208
address=/appspot.com/203.208.45.208
address=/gmail.com/203.208.45.208
address=/top100.cn/203.208.45.208
address=/keyhole.com/203.208.45.208
address=/goo.gl/203.208.45.208
address=/g.co/203.208.45.208
address=/blogspot.com/203.208.45.208
address=/chrome.angrybirds.com/203.208.45.208
#Google End

#Apple START
address=/phobos.apple.com/203.78.36.40
address=/adcdownload.apple.com/203.78.36.40
address=/deimos3.apple.com/203.78.36.40
address=/appldnld.apple.com/203.78.36.40
address=/swcdn.apple.com/203.78.36.40
address=/developer.apple.com/203.78.36.40
#Apple End


#Twitter Start
address=/t.co/199.59.149.243
address=/userstream.twitter.com/199.59.148.139
address=/twitter.com/199.59.149.243
address=/twimg.com/184.169.75.33
address=/tinypic.com/209.17.70.144
address=/bitly.com/69.58.188.34
address=/yfrog.com/208.94.0.61
address=/api.mobilepicture.com/208.87.33.151
#Twitter End

#Wikimedia Start
address=/wikipedia.org/208.80.152.201
address=/wikibooks.org/208.80.152.204
address=/wikinews.org/208.80.152.206
address=/wikiquote.org/208.80.152.201
address=/wikimediafoundation.org/208.80.152.201
address=/mediawiki.org/208.80.152.201
#Wikimedia End

最新的列表在这里查看:http://l4.si/mp1。保存之后将电脑的DNS服务器设置为路由器的IP地址(若选择了截获DNS端口可不用设置),点击开始-运行-ipconfig /flushdns清空本地DNS缓存,自定义的解析规则就生效了。

仅仅是更改域名解析还远远不够,若是搜索的关键词当中包含有敏感词汇,还是会被重置链接。接下来就是要让Chrome浏览器强制对Google使用HTTPS加密协议。

在Chrome的地址栏中输入chrome://net-internals/#hsts并打开,在Add domain的domain处输入需要强制启用HTTPS的网址,并勾选Include subdomains使其子域名也启用HTTPS,点击Add添加。对于Google来说,添加Google.com与Google.com.hk即可。

chrome---net-internals.png

现在,享用Google这道大餐吧。

PS:使用本地Hosts可以达到同样的效果,在http://l4.si/VuC下载自动更新程序。无法下载的话可以尝试下载本站的备份http://l4.si/7Ps。软件使用非常简单,运行后点击更新即可(由于要对Hosts文件进行操作,部分杀毒软件会警报,请放行。使用360安全卫士时请将Hosts文件设为信任)。

2011年12月28日星期三

Tomato PPTP VPN 智能路由 自动切换

Tomato PPTP VPN 智能路由 自动切换:

由于Google在天朝抽风越来越频繁,不得不将Google全站加入到自动切换代理的列表中。最早用来Fan土*啬的工具是GAE,在多APPID多线程下有着不俗的速度。但不知是Chrome下自动切换代理插件的效率问题还是GAE的IP会不定期抽风,经常会出现连接超时、页面响应慢、502错误等。后来换至SSH+GAE,Google、脸书、推特走SSH,其它被土*啬网站走GAE。SSH+GAE配合虽说极品,但每台电脑都这样配置下来,还是略显麻烦。作为一个半吊子的技术宅,自然不会满足。

其实要求很简单,只要能够保证Google、脸书、推特走VPN流量以保证响应速度,其它网站用GAE响应慢点也无妨。突然想到了之前看到的Autoddvpn项目,决定通过路由表的配置来实现自动切换。

正文开始





首先需要一台能刷第三方固件的路由,这里以Tomato固件为例,首先配置好PPTP客户端功能,只用按说明填入服务器地址、用户名、密码即可。在VPN智能路由处选择自定义路由表,路由表的配置需手动填写。

PPTP.png

关于路由表:

自定义路由表中填写的是带掩码位IP段,若访问自定义路由表中的IP段则通过VPN连接,关于各大网站的IP段发现了一个很好的网站http://www.ipduan.com/ 在这里可以查询各大网站使用的IP范围,如图

IPduan.png

如何将IP范围转换为带掩码位的IP段请自行脑补,在这里提供已经换算好的Google、脸书、推特IP地址段:


Google
==================
173.194.0.0/16
198.108.100.192/28
209.185.108.128/25
209.85.128.0/17
216.109.75.80/28
216.239.32.0/19
216.33.229.144/29
216.33.229.160/29
64.233.160.0/19
64.41.221.192/28
64.68.64.64/26
64.68.80.0/21
64.68.88.0/21
66.102.0.0/20
66.249.64.0/19
70.32.128.0/19
72.14.192.0/18
72.14.192.0/16

Facebook
==================
173.252.64.0/18
204.15.20.0/22
66.220.144.0/20
69.171.224.0/19
69.63.176.0/20
74.119.76.0/20

Twitter
==================
199.16.156.0/22
199.59.148.0/22

将这些IP地址段加入到PPTP客户端的自定义路由表中,重启路由使路由表生效。

但由于国内DNS污染问题,会导致部分被墙网站域名无法正确解析,可开启Tomato中截获DNS端口(UDP 53)功能,在DNSmasq中指定被墙网站使用国外DNS,同时在自定义路由表中添加DNS地址,让DNS解析使用VPN加密通道来避免DNS污染。

Google Public DNS IP为:8.8.8.8及8.8.4.4,OpenDNS IP为208.67.222.222及208.67.220.220

若使用Google Public DNS,DNSmasq的规则为:


server=/google.com/8.8.8.8
server=/google.com.hk/8.8.8.8
server=/googleusercontent.com/8.8.8.8
server=/ggpht.com/8.8.8.8
server=/facebook.com/8.8.4.4
server=/fbcdn.net/8.8.4.4
server=/twitter.com/8.8.8.8
server=/twimg.com/8.8.8.8

注意,自定义DNS后一定要将DNS服务器IP添加至自定义路由表中

重启路由,清空电脑的DNS缓存,至此,所有连接到此路由的设备均可以正常的访问Google、脸书以及推特了。

验证:

使用Tracert命令追踪Google、脸书或推特的域名,若出现VPN网关说明成功。

tracert.png

2011年12月23日星期五

【勇士/武士/勇者无敌】高清完美版BD-RMVB完美中字 2011最新美国高分动作大片 多空下载

◎译  名 勇士/武士/勇者无敌(台)
◎片  名 Warrior
◎年  代 2011
◎国  家 美国
◎类  别 动作/剧情/体育
◎语  言 英语
◎字  幕 完美中文字幕
◎IMDB评分  8.3/10 (from 14,224 users) Top 250 #213
◎IMDB链接  http://www.imdb.com/title/tt1291584
◎文件格式 高清完美版BD-RMVB
◎视频尺寸 1280 x 720
◎文件大小 1CD 1.49GB
◎片  长 2 hours 19 minutes
◎导  演 加文·欧康诺 Gavin O'Connor
◎主  演 乔尔·埃哲顿 Joel Edgerton  ....Brendan Conlon
汤姆·哈迪 Tom Hardy  ....Tommy Conlon
尼克·诺特 Nick Nolte  ....Paddy Conlon
詹妮弗·莫里森 Jennifer Morrison  ....Tess Conlon
弗兰克·格里罗 Frank Grillo  ....Frank Campana
凯文·杜恩 Kevin Dunn  ....Principal Zito
Maximiliano Hernández  ....Colt Boyd
布莱恩·考伦 Bryan Callen  ....Himself
Sam Sheridan  ....Himself
Fernando Chien  ....Fenroy (as Fernando Funan Chien)
Jake McLaughlin  ....Mark Bradford
Vanessa Martinez  ....Pilar Fernandez
丹泽尔·惠特克 Denzel Whitaker  ....Stephon
Carlos Miranda  ....Tito
Nick Lehane  ....Nash


◎简  介 


由汤姆·哈迪主演的汤米·赖尔登是个失败的退伍军人,他结束了惨淡的从军生涯后,回到了家乡匹兹堡。他的父亲是个前自由搏击教练,却因为酗酒的恶习而荒废了人生,汤米便在父亲的帮助下,开始进行艰苦的训练,准备参加该项运动史上奖金额最高的搏击锦标赛。而就在他们为取得冠军而艰苦拼搏的时候,汤米的哥哥布莱登也回到了业余拳坛,布莱登当年也是个自由搏击运动员,后来成为了高中老师。布莱登与弟弟汤米、与父亲的关系都紧张火爆而充满了压力,同时也和家庭逐渐疏远。


而今为了维持家用,布莱登放弃了工作重操旧业,走上搏击赛场,并无可避免的与汤米有了竞争关系,他出人意料的突然出现也让兄弟俩的关系越发的微妙碰撞起来,他们一边要去面对过往的矛盾、分道扬镳的经历,同时还要一起去经历比赛场上的拳拳到肉与不赢即输。暴力、情感与谅解就在搏击赛场上充满张力的一触即发了。


一句话评论


《勇士》几乎可以说是一部在任何方面做得都很不错的电影。无论是故事、表演、情节、意义,还是令人热血喷张的搏击场面,它都做得很出色。 ——joblo.com


汤姆·哈迪的表演让人们见识到了他的粗犷和细腻的并重。他的表演给这个角色带来了鲜活的人生体验与性格。 ——filmfracture.com


你不需要是一个自由搏击的粉丝,你也可以从这部讲述家庭关系和兄弟情感的影片中找到乐趣。如果你为了自由搏击才看这部电影的话,那么这部算得上杰作的影片可能还不是很适合你。 ——colesmithey.com


幕后制作


自由搏击家庭剧


本片的导演加文·欧康诺是一个作品不多,但是每一部都算得上是精良制作的导演。他早年拍摄的体育类题材电影《冰上奇迹》早已经成为了体育励志类电影的经典之作。除了体育类影片,他还极擅长把家人之间的冲突放在两厢对立的角度上考量,比如他拍摄的《自由与荣耀》就是这样的代表作。而现在,加文·欧康诺终于得到了一个机会在一部电影里把家庭剧和体育题材结合在一起,这就是他的最新作品《勇士》。


影片的故事有些平淡无奇,说来说去无外乎就是一个不幸福的家庭遭遇到了一些额外的变故,为了生活、为了找回往昔的尊严两个兄弟不约而同地选择了自由搏击的赛场来实现自己的人生价值。当然,影片自然会让兄弟俩在打斗中达到了精神高度的认同和统一,让以往的不快烟消云散。谈及影片的故事,加文·欧康诺说:“我在写剧本的时候特别注意了表现角色生活,也就是说,我用了大量的篇幅来介绍汤姆·哈迪扮演的汤米·莱尔登的生活,他的过往和现状等等。也用了不少时间来介绍他的哥哥布莱登的生活。我觉得把他们的生活介绍清楚,就可以很简单地表现出他们为什么会走上自由搏击的道路,因为生活是他们做出这种选择的动机,也是人物的一种状态。一部电影不能没有冲突,我在影片中把冲突放在了兄弟和父子之间表现。我觉得这应该是冲突的最严重的架势了,亲兄弟之间的搏斗、父子之间势不两立的矛盾,这很有看点。从这个角度上来说,这是一部家庭剧,因为所有的故事和矛盾都发生在家庭成员之间。家庭成员之间的矛盾,比一般人的矛盾要难解决得多,因为亲属的关系,让人们无法面对自己。”


影片中出现的自由搏击,在美国叫做MMA,这是Mixed Martial Arts的缩写。因为这种运动相当残酷,所以即使在美国,它也属于小众运动。而且,运动员是被放在铁笼子里进行比赛的,所以这个运动又被叫做“笼中搏击”。谈到影片中的MMA,加文·欧康诺说:“MMA是时下最流行的一个元素,我们能在很多动作片中看到它的身影,所以我就决定要把这种比赛原汁原味地呈现在电影里。而且我觉得这是一种男人的运动,只有面对生活毫不屈服的硬汉和真正的男人才会钟爱它。加上这部电影讲述的又是一个发生在三个男人之间的故事,我想没有什么能比MMA更适合的了。”


汤姆·哈迪再演猛男


2009年的那部《布朗森》让人们看到了汤姆·哈迪的肌肉与他在银幕上表演时的张力。当然,那部电影对汤姆·哈迪这个英伦演员来说没有什么难度,因为他只是一味地在银幕上展示暴力,只要能爆发出那种自虐的气质,布朗森就被塑造好了。虽然在这部电影里,汤姆·哈迪依然扮演了一个肌肉男,但是这个叫做汤米的男人的生活却远远要比布朗森复杂。


说到这个角色,汤姆·哈迪坦承难度不小。他说:“影片里的人物有自己的过往,而且家庭戏的处理也比较复杂。我演的汤米在家庭破碎后和母亲一起生活,而他的兄弟布莱登则和父亲在一起。后来,汤米失去了自己的母亲,他随后就参了军,参加了海湾战争。然后回来,从此之后的10到15年间再没有和家人说过话。这意味着汤米是一个颇有些放不下的人。所以那个自由搏击的比赛,对于他来说,意义更为重大一些,因为这是他坦露自己心扉,重新和家人进行交流的一种方式。对于布莱登来说,去比赛就是为了赚钱补贴家用。而且,汤米去比赛,更是一种他放下心结,走出生活阴影的方式。这样的人物,塑造起来会比较困难。因为他的言语不多,很多的细节和内容都要从动作和表情中去表现。”


为了能练就一身MMA运动员的肌肉,汤姆·哈迪没少吃苦,他为了这部电影苦练了5个月肌肉,而且还接受了专业的MMA的训练,有《布朗森》等动作片的基础打底,汤姆·哈迪进步神速。但是即使是这样,他还是在训练中打断了肋骨、崴伤了脚,而且还撕裂了自己右手的韧带。汤姆·哈迪说:“这真的是一次难以忘怀的经历,我的训练课程非常多、多到吓死人。这种数量和强度我以前从未见过,已经远远超过了《布朗森》的强度。虽然我并不算胖,但是导演还是不太满意我的身材。为了准备这个角色,我也只有咬着牙去训练了。拍完这部电影,我的身体也算是又上了一个台阶了。”


为了能和汤姆·哈迪配戏,在片中扮演他兄弟的乔尔·埃哲顿以及扮演那位落魄老爹的尼克·诺特都接受了为期5个月的特殊训练。这种训练对今年已经70岁的尼克·诺特来说,难度不小。尼克·诺特说:“这的确很辛苦,不过我只要知道一点标准化的动作,塑塑型就好了,因为我不需要在电影里和什么人真的对打。更多的时候我只是在边上看着别人的训练,自己学一些理论以及专业运动员的语言和习惯动作等等。”但是对于在影片中要和汤姆·哈迪对打的乔尔·埃哲顿而言,这个训练就没那么好玩了,他说:“训练真的很辛苦,但这辛苦也很值得,因为我能因此在银幕上塑造一个真实的MMA运动员,那些动作和对打都是不掺任何水分的,都是实打实的真家伙。”


花絮


·为了表现出自由搏击运动员的彪悍的身形,汤姆·哈迪在影片开拍前的训练中增重了28磅(约合25.4斤)。


·亚特兰大市的标志性建筑,浮桥厅(Boardwalk Hall)在影片中成为了最重要的几场自由搏击比赛的赛场。


·影片的制片厂位于匹茨堡,当地的大学和中学的校舍与教室成为了影片拍摄的场所。


·拍摄完成后,剧组又在西弗吉尼亚州的州立教化所和宾夕法尼亚州补拍了一些镜头。




下载地址


FileSonic下载:

http://www.filesonic.com/file/gfcM5n9
http://www.filesonic.com/file/aTgBD47
http://www.filesonic.com/file/aTgBlzK
http://www.filesonic.com/file/Rv4kx5u











FilePost下载:

http://filepost.com/files/8mcm5e71/ys11.part1.rar
http://filepost.com/files/8275561c/ys11.part2.rar
http://filepost.com/files/14c33em4/ys11.part3.rar
http://filepost.com/files/532a654c/ys11.part4.rar



(FileSonic和FilePost可互补下载)

【新月魅影】高清1280版BD-RMVB国语中字 2011最新上映中国恐怖悬疑惊悚大片 多空下载+在线观看


导演: 黄柏基
编剧: 贺鑫
主演: 陈龙 / 黄俊淇 / 孙佺 / 杨旸 / 罗梓瑄 / 秦子涵 / 钟弦 / 张佳楠
类型: 悬疑 / 惊悚 / 恐怖 / 鬼怪
制片国家/地区: 中国大陆
语言: 汉语普通话
上映日期: 2011-12-20(中国大陆)
片长: 85分钟

剧情简介

风水宝地傅田镇突然有军警离奇死亡,新任镇长一上任便与身为解剖师的妹妹共同查案,但案情非但毫无进展还越发扑朔迷离,军警接连死亡,两人却仍旧毫无头绪。不料镇长因发现当地保安队长与日本商人的盗墓阴谋被陷害入狱,镇长的妹妹为了继续追查凶手和解救哥哥,决定与探案时结识的年轻“法师”合作。在追查凶手的过程中,二人目睹林中被深埋的尸体竟与之前逃脱的杀人凶手是同一人,“僵尸杀人”的传言不胫而走,顿时人心惶惶,恐怖气氛笼罩小镇。而解剖师与法师,现代科学与传统迷信碰撞出的也不仅仅是古墓中的真相……


◎影片播放、下载地址

在线观看:
http://movie.99xh.net/jizai/?net-189.html

FileSonic下载:
http://www.filesonic.com/file/IDNagBK/[www.TianBt.com]xymy.part1.rar
http://www.filesonic.com/file/dy1bFG7/[www.TianBt.com]xymy.part2.rar
http://www.filesonic.com/file/hjyauxn/[www.TianBt.com]xymy.part3.rar


FilePost下载:
http://filepost.com/files/c45a8775/[www.TianBt.com]xymy.part2.rar, [www.TianBt.com]xymy.part2.rar
http://filepost.com/files/f4fda3mb/[www.TianBt.com]xymy.part1.rar, [www.TianBt.com]xymy.part1.rar
http://filepost.com/files/37c1cem5/[www.TianBt.com]xymy.part3.rar, [www.TianBt.com]xymy.part3.rar

(FileSonic和FilePost可互补下载)

2011年12月22日星期四

方力申-《可爱不可爱》/MP3/192/4.93M/FSC/yunfile


专辑:
《Alex Fong Never Walk Alone》
歌手: 方力申
出版时间: 2004年4月28日 
唱片公司: 百代唱片(EMI MUSIC)
歌词:
可爱不可爱 
是最最不可能 才这样吸引 
待你好只怪是我笨  
尽全力难以抱得紧 
若抱紧明知不会合衬  
谁叫我太贪心 要你热吻  
盲目地 与你说天说地  
这叫做残忍定淒美  
明知我后退我也可以避 
偏偏又放纵到扮你知己 

期望你太多 注定难过 
只好怪寂寞令我闯祸 
可换到 几次期待不需关怀都庆贺 
捱下去结果 也是难过  
只有我 自问自答  
这苦心对或错  
天与地难以有人 可拯救到我 
路过几多好人 谁也极吸引  
但到底只会为你恨  
没缘分才会更多心 
没结果才想你步近  
旁人也替我担心 替我怒愤 
明明是个个也漂亮  
偏这样沉溺喜欢你  
宁愿恨你丧失趣味  
偏偏又爱上你没法心死 
不理力量奉献几多  
不顾后患尚有几多 
喜欢你逃避你 你不必知道清楚  
天再大 唯有你能亲手杀死我

下载地址:
FSC:http://www.filesonic.com/file/4336585394
YUNFILE:http://filemarkets.com/file/huafei117/aba11f2c/

五月天 -《第二人生》【FLAC/分軌/390MB/多空】

【專輯名稱 】第二人生TVBNOW 含有熱門話題,最新最快電視,軟體,遊戲,電影,動漫及日常生活及興趣交流等資訊。+ Z% G" G1 v! u! t. \
【專輯歌手 】五月天
【專輯語言 】華語0 R& L, }" j  `7 R# b) [
【發行日期 】2011年12月16日
【音樂格式 】FLAC 
【歌曲大小 】390MB
【檔案空間 】Uploadstation, Filepost, Uploading* t1 [% P1 y# A: @
【解壓密碼 】無
TVBNOW 含有熱門話題,最新最快電視,軟體,遊戲,電影,動漫及日常生活及興趣交流等資訊。6 Q% F4 Q; Y! Z6 l* M


TVBNOW 含有熱門話題,最新最快電視,軟體,遊戲,電影,動漫及日常生活及興趣交流等資訊。# e9 M% f9 R+ d0 H7 l% o
【專輯介紹】
tvb now,tvbnow,bttvb,tv series,tv drama,movie,bt,download3 g  C3 G& P) `
這是世界上最後一張五月天專輯,除非2012不是世界末日…
再見 黑白老照片 回憶電影院 埋進地面TVBNOW 含有熱門話題,最新最快電視,軟體,遊戲,電影,動漫及日常生活及興趣交流等資訊。9 h, k  c; l# M
晚安 底片和唱片 沉浮在浪間 就像詩篇tvboxnow.com! z8 f7 b+ J  f, _! F5 u3 B2 T$ l7 \


【專輯曲目】公仔箱論壇( Q$ J) ~( B% c

01.2012tvboxnow.com! `$ ?; r" d, E: u! j- T' b7 U
02.倉頡& v# t5 o( d/ a6 o- [3 ]
03.洗衣機
04.歪腰
05.乾杯tvboxnow.com- |! i) i: D+ Q
06.我不願 讓你一個人
07.星空公仔箱論壇2 }2 X1 Q' N) H$ t# J5 X
08.三個傻瓜
09.末日
10.OAOA (丟掉名字性別)
11.第二人生
12.諾亞方舟
13.有些事現在不做 一輩子都不會做了TVBNOW 含有熱門話題,最新最快電視,軟體,遊戲,電影,動漫及日常生活及興趣交流等資訊。! Z6 B" r- A; E, B2 F
14.Blank Track 1公仔箱論壇5 r2 r0 l& N- |& t% {
15.Blank Track 2公仔箱論壇8 V7 f1 t/ z$ A' N$ ~3 M
16.Bonus Track : T1 21 31 21
6 k* N5 K, `3 B9 D5 _% |, W. R
**你們的回復就是我分享的動力**
TVBNOW 含有熱門話題,最新最快電視,軟體,遊戲,電影,動漫及日常生活及興趣交流等資訊。8 j9 A4 j1 {) A

【Links】:
公仔箱論壇4 W7 `9 y, G4 t9 ?
【Uploadstation】/ Z& x, B. L) a; `* n) f3 O8 o
五月天 -《第二人生》

【Filepost】TVBNOW 含有熱門話題,最新最快電視,軟體,遊戲,電影,動漫及日常生活及興趣交流等資訊。# T' r! D/ G% c$ p- z3 D
五月天 -《第二人生》
8 ]2 E" G) J: x4 I. H
【filesonic】tvboxnow.com& t4 l6 q6 L. `
五月天 -《第二人生》 part 1
五月天 -《第二人生》 part 2TVBNOW 含有熱門話題,最新最快電視,軟體,遊戲,電影,動漫及日常生活及興趣交流等資訊。- @& b# X2 r8 y! O5 K
五月天 -《第二人生》 part 3公仔箱論壇* U7 p% v/ S3 V$ b
五月天 -《第二人生》 part 4TVBNOW 含有熱門話題,最新最快電視,軟體,遊戲,電影,動漫及日常生活及興趣交流等資訊。4 V& y+ ?2 a) O" ?
公仔箱論壇  J* z/ N! ]: {1 `( v  D' v

聲明:   
本專輯版權屬唱片公司所有,只可用于個人試聽交流使用,( g! u( r$ `9 A8 Y5 H- J2 m
禁用于任何商業用途或公開傳播的場合, 請在試聽后24小時內刪除。TVBNOW 含有熱門話題,最新最快電視,軟體,遊戲,電影,動漫及日常生活及興趣交流等資訊。; a) X  a4 b' z: k# B( R0 s  ^
本人不承擔與之相關的一切法律責任,tvb now,tvbnow,bttvb,tv series,tv drama,movie,bt,download9 \/ l4 I3 g' b: r5 R
如您喜歡此CD的內容,請購買正版CD!