把openresty部署到生产环境的编译选项还需要那些?

178 views
Skip to first unread message

Zheng Ping

unread,
Dec 16, 2012, 10:53:02 PM12/16/12
to open...@googlegroups.com

我自己的机器上的openresty编辑指令:
./configure --prefix=/home/zhen/app/openresty --with-luajit --user=zhen --group=zhen --pid-path=/home/zhen/temp/nginx/openresty.pid --error-log-path=/home/zhen/temp/openresty_error.log

我编译下来的nginx有11M之多,我如果要把他部署到生产环境,是不是还需要哪些特殊的编译参数啊?
thanks!
--
with kind regards

smallfish

unread,
Dec 16, 2012, 11:51:46 PM12/16/12
to open...@googlegroups.com
openresty/nginx 需要的参数,主要跟你的应用和需求有关。一般来说user/group/pid/log这些不需要指定的。

我一般习惯就是指定prefix,with-drizzle/status
--



2012/12/17 Zheng Ping <kyt...@gmail.com>

--
with kind regards

--
邮件自: 列表“openresty”,专用于技术讨论!
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+...@googlegroups.com
详情: http://groups.google.com/group/openresty
官网: http://openresty.org/
仓库: https://github.com/agentzh/ngx_openresty
建议: 提问的智慧 http://wiki.woodpecker.org.cn/moin/AskForHelp
教程: http://agentzh.org/misc/nginx/agentzh-nginx-tutorials-zhcn.html

Bill Zhu

unread,
Dec 17, 2012, 3:43:18 AM12/17/12
to open...@googlegroups.com
生产环境用什么功能,就编译什么模块。个人建议--with-luajit一定要加。

详细编译参数查看:
cd path/to/openresty
./configure --help

agentzh

unread,
Dec 22, 2012, 2:06:21 AM12/22/12
to open...@googlegroups.com
Hello!

2012/12/16 Zheng Ping:


>
> 我自己的机器上的openresty编辑指令:
> ./configure --prefix=/home/zhen/app/openresty --with-luajit --user=zhen
> --group=zhen --pid-path=/home/zhen/temp/nginx/openresty.pid
> --error-log-path=/home/zhen/temp/openresty_error.log
>
> 我编译下来的nginx有11M之多,我如果要把他部署到生产环境,
> 是不是还需要哪些特殊的编译参数啊?

值得指出的是,nginx 的构建系统默认是启用可执行文件中的调试符号的,你的 nginx 可执行文件中当有近 90% 的内容是调试符号。

这些调试信息并不会对 nginx 进程的内存占用大小造成什么影响。现代操作系统是按需读取可执行文件中的这些调试信息的。

你可以使用 strip 命令除去你的 nginx 可执行文件中的调试符号,这应当可以把可执行文件的大小减低到 1MB 左右(在我的
Linux x86_64 系统上,默认构造出来的 nginx 可执行文件在 strip 之后只有 996KB)。但我不建议你手动
strip,因为这会让你的 nginx 无法通过 gdb 或者 systemtap 这样的工具调试问题。

如果你真的在意,可以使用 ./configure --help 得到那些 --without-http_xxxx_module
的选项列表。使用这些选项禁用你并没有使用到的模块,可以减小 nginx 可执行文件的大小。

Best regards,
-agentzh

Reply all
Reply to author
Forward
0 new messages