在路由上建站,除了受到路由器本身性能的限制外,影响访问体验的另外一个因素就是网络的上行速度。因此在路由器的性能一定的条件下,只有优化输出文件的大小,才能达到提升浏览体验的目的。下面谈下我的两个优化思路(更加详细的说明见我的博客www.damuzi.net):
- lighttpd优化
opkg install lighttpd-mod-compress
vi /etc/lighttpd/lighttpd.conf
找到 server.modules = ( 加入 "mod_compress", 以启用compress模块
找到 #### compress module 加入
compress.allowed-encodings = ("bzip2", "gzip", "deflate")
compress.cache-dir = "/mnt/sda1/tmp"
compress.filetype = ("text/plain", "text/html", "text/css", "text/javascript")
:x
- php优化
也需要安装apc模块 zlib模块
zlib.output_compression = On
zlib.output_compression_level = 6
zlib.output_handler =On
apc.enabled = 1
apc.shm_segments = 1 ;The number of shared memory segments to allocate for th
apc.shm_size = 6M ;The size of each shared memory segment.
apc.ttl =21600 ;The time of renew the cache.
经过优化后,路由会先压缩要输出的文件,在客户端解压输出,而压缩的效率达到50%以上,大大减少了客户端接收文件的时间,效果非常满意。
还是有一点问题的,主要是主页显示不全,今天早上跳闸之后盒子没有爬的起来,所以今天都没有能很好的管理,明天来看看,试一试装一个Mysql看看,不知会不会好一点,关键是我原来的SQLite的数据库不知要如何才能转到MYsql上!