$ ./configure
checking for unistd.h ... found
checking for inttypes.h ... found
checking for limits.h ... found
checking for sys/filio.h ... not found
checking for C compiler ... unknown
checking for gcc variadic macros ... found
checking for C99 variadic macros ... found
checking for OS
+ Linux 2.6.32-279.el6.x86_64x86_64
+using rt signals
checking for epoll... found
checking for sendfile()... found
checking for sendfile64()... found
checking for sys/prctl.h ... found
checking for prctl(PR_SET_DUMPABLE) ...found
checking for /dev/poll ... not found
checking for kqueue... not found
checking for PCRElibrary ... not found
checking for zliblibrary ... not found
checking for int size ... 4 bytes
checking for longsize ... 8 bytes
checking for longlong size ... 8 bytes
checking for void *size ... 8 bytes
checking for uint64_t ... found
checking for sig_atomic_t ... found
checking for sig_atomic_t size ... 4 bytes
auto/types/value: line 9:warning: here-document at line 5 delimited by end-of-file (wanted `END')
checking for socklen_t ... found
checking for in_addr_t ... found
checking for in_port_t ... found
checking for rlim_t ... found
checking for uintptr_t ... uintptr_t found
checking for systemendianess ... little endianess
auto/types/value: line 9: warning:here-document at line 5 delimited by end-of-file (wanted `END')
auto/types/value: line 9: warning:here-document at line 5 delimited by end-of-file (wanted `END')
auto/types/value: line 9: warning: here-documentat line 5 delimited by end-of-file (wanted `END')
checking for setproctitle() ... not found
checking for pread() ... found
checking for pwrite() ... found
checking for strerror_r() ... found
checking for gnu style strerror_r() ...found but is not working
checking for localtime_r() ... found
checking for posix_memalign() ... found
checking for memalign() ... found
checking for sched_yield() ... found
checking for mmap(MAP_ANON|MAP_SHARED)... found
checking for mmap("/dev/zero",MAP_SHARED) ... found
checking for System V shared memory ...found
checking for struct msghdr.msg_control ...found
checking for ioctl(FIONBIO) ... found
checking for struct tm.tm_gmtoff ... found
Configuration summary
+threads are not used
+PCRE library is not found
+ md5 library is not used
+OpenSSL library is not used
+zlib library is not found
./configure: error:the HTTP rewrite module requires the PCRE library.
You can either disable the module by using--without-http_rewrite_module
option, or install the PCRE library intothe system, or build the PCRE library
statically from the source with nginx byusing --with-pcre=
auto/types/value: line 9: warning:here-document at line 5 delimited by end-of-file (wanted `END')
查看高版本到nginx,在文件auto/types/value末尾添加“END”即可
$ sudo apt-get install libpcre3-dev # Ubuntu
$ sudo yum install pcre-devel # CentOS
注意:sudo yum install pcre不行,必须是pcre-devel
......
Configuration summary
+threads are not used
+using system PCRE library
+md5 library is not used
+OpenSSL library is not used
+zlib library is not found
./configure: error:the HTTP gzip module requires the zlib library.
You can either disable the module by using--without-http_gzip_module
option, or install the zlib library intothe system, or build the zlib library
statically from the source with nginx byusing --with-zlib=
$ sudo apt-get install zlib1g-dev
$ sudo yum install zlib-devel
......
Configuration summary
+threads are not used
+using system PCRE library
+md5 library is not used
+OpenSSL library is not used
+using system zlib library
nginx path prefix: /usr/local/nginx
nginx binary file: /usr/local/nginx/sbin/nginx
nginx configuration file: /usr/local/nginx/conf/nginx.conf
nginx pid file: /usr/local/nginx/logs/nginx.pid
nginx error log file: /usr/local/nginx/logs/error.log
nginx http access log file: /usr/local/nginx/logs/access.log
到这里,基本问题已经解决
$ sudo apt-get install openssl
$ sudo apt-get install libssl-dev
$ sudo yum install openssl
$ sudo yum install openssl-devel
$ ./configure --with-http_ssl_module
Configuration summary
+threads are not used
+using system PCRE library
+md5 library is not used
+using system OpenSSL library
+using system zlib library
nginx path prefix: /usr/local/nginx
nginx binary file: /usr/local/nginx/sbin/nginx
nginx configuration file: /usr/local/nginx/conf/nginx.conf
nginx pid file: /usr/local/nginx/logs/nginx.pid
nginx error log file: /usr/local/nginx/logs/error.log
nginx http access log file: /usr/local/nginx/logs/access.log
更多编译选项:
http://nginx.org/en/docs/install.html
http://my.oschina.net/xu01/blog/26167
./configure–help
$ make
make -f objs/Makefile
make[1]: Entering directory`/share/linux-data/prj/nginx-0.1.10'
gcc -c -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-oobjs/src/core/nginx.o \
src/core/nginx.c
gcc -c -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-oobjs/src/core/ngx_log.o \
src/core/ngx_log.c
gcc -c -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-oobjs/src/core/ngx_palloc.o \
src/core/ngx_palloc.c
......
gcc -c -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -Isrc/http -I src/http/modules -I src/http/modules/proxy \
-oobjs/src/http/modules/proxy/ngx_http_proxy_header.o \
src/http/modules/proxy/ngx_http_proxy_header.c
gcc -c -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-oobjs/ngx_modules.o \
objs/ngx_modules.c
o objs/nginx \ # 这里似乎有问题,见下面
objs/src/core/nginx.o\
objs/src/core/ngx_log.o\
objs/src/core/ngx_palloc.o\
objs/src/core/ngx_array.o\
objs/src/core/ngx_list.o\
objs/src/core/ngx_buf.o\
objs/src/core/ngx_output_chain.o\
……
objs/src/http/modules/proxy/ngx_http_proxy_header.o\
objs/ngx_modules.o\
-lpcre-lssl -lcrypto -lz
make[1]: o:命令未找到
make[1]: [objs/nginx] 错误 127 (忽略)
make[1]: Leaving directory`/share/linux-data/prj/nginx-0.1.10'
继续查看objs/Makefile,发现 “LINK” 变量未赋值,参考nginx-0.7.69,发现 “LINK = $(CC)”, 添加编译即可通过(注意:此处不能填 “LINK=ld”)
更合理的方式是修改生成 objs/Makefile 的模板文件,查看 nginx-0.7.69, 发现在 auto/cc/conf 中有一行 LINK="\$(CC)", 增加即可,然后:
$ make clean
$ ./configure --with-http_ssl_module
$ make
$ sudo /usr/local/nginx/sbin/nginx
[sudo] password for root:
2013/03/0614:47:01 [emerg]19019#0:getgrnam("nogroup")failed
查看源代码nginx.c中ngx_getopt函数,这是获取命令行参数的函数,”-t”是测试nginx.conf配置文件
$ sudo /usr/local/nginx/sbin/nginx -t
[sudo] password for root:
2013/03/0614:55:20 [info] 19154#0: theconfiguration file/usr/local/nginx/conf/nginx.conf syntax is ok
2013/03/0614:55:20 [emerg] 19154#0:getgrnam("nogroup") failed
2013/03/0614:55:20 [emerg] 19154#0: theconfiguration file"/usr/local/nginx/conf/nginx.conf" test failed
修改nginx.conf配置文件(参考:http://www.inginx.com/nginx-conf-in/),运行OK
$ ./configure
checking for unistd.h ... not found
checking for inttypes.h ... not found
checking for limits.h ... not found
checking for sys/filio.h ... not found
checking for C compiler ... unknown
checking for gcc variadic macros ... notfound
checking for C99 variadic macros ... notfound
checking for OS
+Linux 2.6.32-358.el6.i686 i686
grep:/usr/include/linux/version.h: 没有那个文件或目录
auto/os/linux: line 38: [: too manyarguments
checking for epoll ... not found
checking for sendfile() ... not found
checking for sendfile64() ... not found
checking for sys/prctl.h ... not found
checking for prctl(PR_SET_DUMPABLE) ... notfound
checking for /dev/poll ... not found
checking for kqueue ... not found
checking for PCRE library ... not found
checking for zlib library ... not found
checking for int size ...
./configure: error:can not detect int size
auto/types/value: line 9: warning:here-document at line 5 delimited by end-of-file (wanted `END')
查看高版本到nginx,在文件auto/types/value末尾添加“END”即可
$ yum install pcre-devel zlib-devel opensslopenssl-devel
$ ./configure --with-http_ssl_module
checking for unistd.h ... found
checking for inttypes.h ... found
checking for limits.h ... found
checking for sys/filio.h ... not found
checking for C compiler ... unknown
checking for gcc variadic macros ... found
checking for C99 variadic macros ... found
checking for OS
+Linux 2.6.32-358.el6.i686 i686
+using rt signals
checking for epoll ... found
checking for sendfile() ... found
checking for sendfile64() ... found
checking for sys/prctl.h ... found
checking for prctl(PR_SET_DUMPABLE) ...found
checking for /dev/poll ... not found
checking for kqueue ... not found
checking for PCRE library ... found
checking for OpenSSL library ... found
checking for zlib library ... found
checking for int size ... 4 bytes
checking for longsize ... 4 bytes
checking for longlong size ... 8 bytes
checking for void *size ... 4 bytes
# 可以发现 long类型和指针类型的长度跟机器字长是一致的
checking for uint64_t ... found
checking for sig_atomic_t ... found
checking for sig_atomic_t size ... 4 bytes
checking for socklen_t ... found
checking for in_addr_t ... found
checking for in_port_t ... found
checking for rlim_t ... found
checking for uintptr_t ... uintptr_t found
checking for system endianess ... littleendianess
checking for setproctitle() ... not found
checking for pread() ... found
checking for pwrite() ... found
checking for strerror_r() ... found but isnot working
checking for gnu style strerror_r() ...found
checking for localtime_r() ... found
checking for posix_memalign() ... found
checking for memalign() ... found
checking for sched_yield() ... found
checking for mmap(MAP_ANON|MAP_SHARED) ...found
checking for mmap("/dev/zero",MAP_SHARED) ... found
checking for System V shared memory ...found
checking for struct msghdr.msg_control ...found
checking for ioctl(FIONBIO) ... found
checking for struct tm.tm_gmtoff ... found
Configuration summary
+ threadsare not used
+using system PCRE library
+md5 library is not used
+using system OpenSSL library
+using system zlib library
nginx path prefix: /usr/local/nginx
nginx binary file: /usr/local/nginx/sbin/nginx
nginx configuration file: /usr/local/nginx/conf/nginx.conf
nginx pid file: /usr/local/nginx/logs/nginx.pid
nginx error log file: /usr/local/nginx/logs/error.log
nginx http access log file: /usr/local/nginx/logs/access.log