谈下路由建站的速度优化,令人满意

来源:互联网 发布:android 网络协议 编辑:程序博客网 时间:2024/05/16 11:36
在路由上建站,除了受到路由器本身性能的限制外,影响访问体验的另外一个因素就是网络的上行速度。因此在路由器的性能一定的条件下,只有优化输出文件的大小,才能达到提升浏览体验的目的。下面谈下我的两个优化思路(更加详细的说明见我的博客www.damuzi.net):
1. 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 

2. 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%以上,大大减少了客户端接收文件的时间,效果非常满意。
0 0
原创粉丝点击