Nginx信息: 版本: 0.9.3 对原版的修改, 将auto/cc/gcc的-g去掉,将-O改为-O2 附上原始数据,比较长:

#默认编译
./configure
make
ll objs/nginx
make clean
#File size 525556
#--with-cc-opt=-g 2444312
#--with-cc-opt=-g --with-debug 2513996

#加载大部分可选模块
./configure --with-http_ssl_module \
        --with-http_realip_module \
        --with-http_addition_module \
        --with-http_xslt_module \
        --with-http_sub_module \
        --with-http_dav_module \
        --with-http_flv_module \
        --with-http_gzip_static_module \
        --with-http_random_index_module \
        --with-http_secure_link_module \
        --with-http_degradation_module \
        --with-http_stub_status_module \
        --with-http_perl_module
make > /dev/null
ll objs/nginx
make clean
#File size 642031
#--with-cc-opt=-g 4557807
#--with-cc-opt=-g --with-debug 4689478

#移除大部分可以移除的模块
./configure         --without-http_charset_module \
        --without-http_gzip_module \
        --without-http_ssi_module \
        --without-http_userid_module \
        --without-http_access_module \
        --without-http_auth_basic_module \
        --without-http_autoindex_module \
        --without-http_status_module \
        --without-http_geo_module \
        --without-http_map_module \
        --without-http_split_clients_module \
        --without-http_referer_module \
        --without-http_rewrite_module \
        --without-http_proxy_module \
        --without-http_fastcgi_module \
        --without-http_uwsgi_module \
        --without-http_scgi_module \
        --without-http_memcached_module \
        --without-http_limit_zone_module \
        --without-http_limit_req_module \
        --without-http_empty_gif_module \
        --without-http_browser_module \
        --without-http_upstream_ip_hash_module
make
ll objs/nginx
make clean
#File size 357657
#--with-cc-opt=-g 1556885
#--with-cc-opt=-g --with-debug 1616309

#进一步移除Http-Cache
./configure         --without-http_charset_module \
        --without-http_gzip_module \
        --without-http_ssi_module \
        --without-http_userid_module \
        --without-http_access_module \
        --without-http_auth_basic_module \
        --without-http_autoindex_module \
        --without-http_status_module \
        --without-http_geo_module \
        --without-http_map_module \
        --without-http_split_clients_module \
        --without-http_referer_module \
        --without-http_rewrite_module \
        --without-http_proxy_module \
        --without-http_fastcgi_module \
        --without-http_uwsgi_module \
        --without-http_scgi_module \
        --without-http_memcached_module \
        --without-http_limit_zone_module \
        --without-http_limit_req_module \
        --without-http_empty_gif_module \
        --without-http_browser_module \
        --without-http_upstream_ip_hash_module \
        --without-http-cache
make
ll objs/nginx
make clean
#File size 343543
#--with-cc-opt=-g 1467019
#--with-cc-opt=-g --with-debug 1521963

附上图表(使用Google Chart). 解释: 1. 第一组, 添加大部分可选模块 如gzip_static SSL等 2. 第二组, 默认配置 3. 第三组, 移除大部分可移除的模块, 使用 –without-http_XXXX 4. 第四组, 在第三组基础上,再移除Http-Cache

图表中的Y轴的单位为字节.

PS: 本blog使用的Nginx大小为450k,哈哈! 编译参数:

root@ubuntu:~# /usr/local/nginx/sbin/nginx -V
nginx: nginx version: nginx/0.9.3
nginx: built by gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
nginx: configure arguments: --user=www --group=www 
--prefix=/usr/local/nginx --with-http_stub_status_module 
--with-http_gzip_static_module --with-cc-opt=-ltcmalloc 
--without-http_empty_gif_module --without-http_split_clients_module 
--without-http_geo_module --without-http_auth_basic_module 
--without-http_memcached_module --with-cpu-opt=pentium4 
--without-http_uwsgi_module --without-http_scgi_module


blog comments powered by Disqus

Published

2011-01-17 19:45:47

Categories


Tags

Fork me on GitHub