---
title: "CentOS下安装nginx步骤"
author: "codingstandards"
date: "2012-06-14T13:50:47Z"
tags: []
categories: ["互联网"]
slug: "centos-nginx"
draft: false
lastmod: "2012-06-14T13:51:32Z"
id: 1560835
url: "https://codingstandards.iteye.com/blog/1560835"
---

nginx版本：最新版的稳定版 nginx 1.2.1

操作系统：CentOS 5.8

 

步骤如下：（假定安装在/opt/nginx目录中）

mkdir nginx

cd nginx/

wget http://nginx.org/download/nginx-1.2.1.tar.gz

tar zxf nginx-1.2.1.tar.gz

cd nginx-1.2.1

./configure --prefix=/opt/nginx

make && make install

 

根据安装过程中的错误提示，可能需要安装pcre开发包

yum install -y pcre-devel

 

详细记录如下：

\[root@www setup]$ mkdir nginx  
\[root@www setup]$ cd nginx/  
\[root@www nginx]$ wget http://nginx.org/download/nginx-1.2.1.tar.gz  
\--2012-06-14 10:29:25--  http://nginx.org/download/nginx-1.2.1.tar.gz  
正在解析主机 nginx.org... 206.251.255.63  
Connecting to nginx.org|206.251.255.63|:80... 已连接。  
已发出 HTTP 请求，正在等待回应... 200 OK  
长度：718161 (701K) \[application/octet-stream]  
Saving to: \`nginx-1.2.1.tar.gz'

100%\[=============================================================================================================================&gt;] 718,161     65.8K/s   in 15s    

2012-06-14 10:29:41 (46.3 KB/s) - \`nginx-1.2.1.tar.gz' saved \[718161/718161]

\[root@www nginx]$ tar zxf nginx-1.2.1.tar.gz  
\[root@www nginx]$ cd nginx-1.2.1  
\[root@www nginx-1.2.1]$ ls  
auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  man  README  src  
\[root@www nginx-1.2.1]$ ./configure --prefix=/opt/nginx  
checking for OS  
 + Linux 2.6.18-164.6.1.el5xen i686  
checking for C compiler ... found  
checking for gcc builtin atomic operations ... not found  
checking for C99 variadic macros ... found  
checking for gcc variadic macros ... found  
checking for unistd.h ... found  
checking for inttypes.h ... found  
checking for limits.h ... found  
checking for sys/filio.h ... not found  
checking for sys/param.h ... found  
checking for sys/mount.h ... found  
checking for sys/statvfs.h ... found  
checking for crypt.h ... found  
checking for Linux specific features  
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 sched\_setaffinity() ... found  
checking for crypt\_r() ... found  
checking for sys/vfs.h ... found  
checking for nobody group ... found  
checking for poll() ... found  
checking for /dev/poll ... not found  
checking for kqueue ... not found  
checking for crypt() ... not found  
checking for crypt() in libcrypt ... found  
checking for F\_READAHEAD ... not found  
checking for posix\_fadvise() ... found  
checking for O\_DIRECT ... found  
checking for F\_NOCACHE ... not found  
checking for directio() ... not found  
checking for statfs() ... found  
checking for statvfs() ... found  
checking for dlopen() ... not found  
checking for dlopen() in libdl ... found  
checking for sched\_yield() ... found  
checking for SO\_SETFIB ... not found  
checking for SO\_ACCEPTFILTER ... not found  
checking for TCP\_DEFER\_ACCEPT ... found  
checking for TCP\_KEEPIDLE, TCP\_KEEPINTVL, TCP\_KEEPCNT ... found  
checking for TCP\_INFO ... not found  
checking for accept4() ... not found  
checking for int size ... 4 bytes  
checking for long size ... 4 bytes  
checking for long long size ... 8 bytes  
checking for void * size ... 4 bytes  
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 ... little endianess  
checking for size\_t size ... 4 bytes  
checking for off\_t size ... 8 bytes  
checking for time\_t size ... 4 bytes  
checking for setproctitle() ... not found  
checking for pread() ... found  
checking for pwrite() ... found  
checking for sys\_nerr ... found  
checking for localtime\_r() ... found  
checking for posix\_memalign() ... found  
checking for memalign() ... 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 POSIX semaphores ... not found  
checking for POSIX semaphores in libpthread ... found  
checking for struct msghdr.msg\_control ... found  
checking for ioctl(FIONBIO) ... found  
checking for struct tm.tm\_gmtoff ... found  
checking for struct dirent.d\_namlen ... not found  
checking for struct dirent.d\_type ... found  
checking for sysconf(\_SC\_NPROCESSORS\_ONLN) ... found  
checking for openat(), fstatat() ... found  
checking for PCRE library ... not found  
checking for PCRE library in /usr/local/ ... not found  
checking for PCRE library in /usr/include/pcre/ ... not found  
checking for PCRE library in /usr/pkg/ ... not found  
checking for PCRE library in /opt/local/ ... 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 into the system, or build the PCRE library  
statically from the source with nginx by using --with-pcre=&lt;path&gt; option.

\[root@www nginx-1.2.1]$ yum install -y pcre-devel  
Loaded plugins: fastestmirror  
Loading mirror speeds from cached hostfile  
 * base: mirrors.163.com  
 * extras: mirrors.163.com  
 * updates: mirrors.btte.net  
Setting up Install Process  
Resolving Dependencies  
\--&gt; Running transaction check  
\---&gt; Package pcre-devel.i386 0:6.6-6.el5\_6.1 set to be updated  
\--&gt; Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================================================  
 Package                                   Arch                                Version                                       Repository                           Size  
\=======================================================================================================================================================================  
Installing:  
 pcre-devel                                i386                                6.6-6.el5\_6.1                                 base                                181 k

Transaction Summary  
\=======================================================================================================================================================================  
Install       1 Package(s)  
Upgrade       0 Package(s)

Total download size: 181 k  
Downloading Packages:  
pcre-devel-6.6-6.el5\_6.1.i386.rpm                                                                                                               | 181 kB     00:00      
Running rpm\_check\_debug  
Running Transaction Test  
Finished Transaction Test  
Transaction Test Succeeded  
Running Transaction  
  Installing     : pcre-devel                                                                                                                                      1/1

Installed:  
  pcre-devel.i386 0:6.6-6.el5\_6.1                                                                                                                                     

Complete!  
\[root@www nginx-1.2.1]$

\[root@www nginx-1.2.1]$ ./configure --prefix=/opt/nginx  
checking for OS  
 + Linux 2.6.18-164.6.1.el5xen i686  
checking for C compiler ... found  
checking for gcc builtin atomic operations ... not found  
checking for C99 variadic macros ... found  
checking for gcc variadic macros ... found  
checking for unistd.h ... found  
checking for inttypes.h ... found  
checking for limits.h ... found  
checking for sys/filio.h ... not found  
checking for sys/param.h ... found  
checking for sys/mount.h ... found  
checking for sys/statvfs.h ... found  
checking for crypt.h ... found  
checking for Linux specific features  
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 sched\_setaffinity() ... found  
checking for crypt\_r() ... found  
checking for sys/vfs.h ... found  
checking for nobody group ... found  
checking for poll() ... found  
checking for /dev/poll ... not found  
checking for kqueue ... not found  
checking for crypt() ... not found  
checking for crypt() in libcrypt ... found  
checking for F\_READAHEAD ... not found  
checking for posix\_fadvise() ... found  
checking for O\_DIRECT ... found  
checking for F\_NOCACHE ... not found  
checking for directio() ... not found  
checking for statfs() ... found  
checking for statvfs() ... found  
checking for dlopen() ... not found  
checking for dlopen() in libdl ... found  
checking for sched\_yield() ... found  
checking for SO\_SETFIB ... not found  
checking for SO\_ACCEPTFILTER ... not found  
checking for TCP\_DEFER\_ACCEPT ... found  
checking for TCP\_KEEPIDLE, TCP\_KEEPINTVL, TCP\_KEEPCNT ... found  
checking for TCP\_INFO ... not found  
checking for accept4() ... not found  
checking for int size ... 4 bytes  
checking for long size ... 4 bytes  
checking for long long size ... 8 bytes  
checking for void * size ... 4 bytes  
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 ... little endianess  
checking for size\_t size ... 4 bytes  
checking for off\_t size ... 8 bytes  
checking for time\_t size ... 4 bytes  
checking for setproctitle() ... not found  
checking for pread() ... found  
checking for pwrite() ... found  
checking for sys\_nerr ... found  
checking for localtime\_r() ... found  
checking for posix\_memalign() ... found  
checking for memalign() ... 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 POSIX semaphores ... not found  
checking for POSIX semaphores in libpthread ... found  
checking for struct msghdr.msg\_control ... found  
checking for ioctl(FIONBIO) ... found  
checking for struct tm.tm\_gmtoff ... found  
checking for struct dirent.d\_namlen ... not found  
checking for struct dirent.d\_type ... found  
checking for sysconf(\_SC\_NPROCESSORS\_ONLN) ... found  
checking for openat(), fstatat() ... found  
checking for PCRE library ... found  
checking for PCRE JIT support ... not found  
checking for system md library ... not found  
checking for system md5 library ... not found  
checking for OpenSSL md5 crypto library ... not found  
checking for sha1 in system md library ... not found  
checking for OpenSSL sha1 crypto library ... not found  
checking for zlib library ... found  
creating objs/Makefile

Configuration summary  
  + using system PCRE library  
  + OpenSSL library is not used  
  + using builtin md5 code  
  + sha1 library is not found  
  + using system zlib library

  nginx path prefix: "/opt/nginx"  
  nginx binary file: "/opt/nginx/sbin/nginx"  
  nginx configuration prefix: "/opt/nginx/conf"  
  nginx configuration file: "/opt/nginx/conf/nginx.conf"  
  nginx pid file: "/opt/nginx/logs/nginx.pid"  
  nginx error log file: "/opt/nginx/logs/error.log"  
  nginx http access log file: "/opt/nginx/logs/access.log"  
  nginx http client request body temporary files: "client\_body\_temp"  
  nginx http proxy temporary files: "proxy\_temp"  
  nginx http fastcgi temporary files: "fastcgi\_temp"  
  nginx http uwsgi temporary files: "uwsgi\_temp"  
  nginx http scgi temporary files: "scgi\_temp"

\[root@www nginx-1.2.1]$

\[root@www nginx-1.2.1]$  
\[root@www nginx-1.2.1]$ make && make install  
make -f objs/Makefile  
make\[1]: Entering directory \`/root/setup/nginx/nginx-1.2.1'  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/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 \\  
                -o objs/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 \\  
                -o objs/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 \\  
                -o objs/src/core/ngx\_array.o \\  
                src/core/ngx\_array.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_list.o \\  
                src/core/ngx\_list.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_hash.o \\  
                src/core/ngx\_hash.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_buf.o \\  
                src/core/ngx\_buf.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_queue.o \\  
                src/core/ngx\_queue.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_output\_chain.o \\  
                src/core/ngx\_output\_chain.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_string.o \\  
                src/core/ngx\_string.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_parse.o \\  
                src/core/ngx\_parse.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_inet.o \\  
                src/core/ngx\_inet.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_file.o \\  
                src/core/ngx\_file.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_crc32.o \\  
                src/core/ngx\_crc32.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_murmurhash.o \\  
                src/core/ngx\_murmurhash.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_md5.o \\  
                src/core/ngx\_md5.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_rbtree.o \\  
                src/core/ngx\_rbtree.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_radix\_tree.o \\  
                src/core/ngx\_radix\_tree.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_slab.o \\  
                src/core/ngx\_slab.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_times.o \\  
                src/core/ngx\_times.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_shmtx.o \\  
                src/core/ngx\_shmtx.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_connection.o \\  
                src/core/ngx\_connection.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_cycle.o \\  
                src/core/ngx\_cycle.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_spinlock.o \\  
                src/core/ngx\_spinlock.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_cpuinfo.o \\  
                src/core/ngx\_cpuinfo.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_conf\_file.o \\  
                src/core/ngx\_conf\_file.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_resolver.o \\  
                src/core/ngx\_resolver.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_open\_file\_cache.o \\  
                src/core/ngx\_open\_file\_cache.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_crypt.o \\  
                src/core/ngx\_crypt.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/event/ngx\_event.o \\  
                src/event/ngx\_event.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/event/ngx\_event\_timer.o \\  
                src/event/ngx\_event\_timer.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/event/ngx\_event\_posted.o \\  
                src/event/ngx\_event\_posted.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/event/ngx\_event\_busy\_lock.o \\  
                src/event/ngx\_event\_busy\_lock.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/event/ngx\_event\_accept.o \\  
                src/event/ngx\_event\_accept.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/event/ngx\_event\_connect.o \\  
                src/event/ngx\_event\_connect.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/event/ngx\_event\_pipe.o \\  
                src/event/ngx\_event\_pipe.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_time.o \\  
                src/os/unix/ngx\_time.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_errno.o \\  
                src/os/unix/ngx\_errno.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_alloc.o \\  
                src/os/unix/ngx\_alloc.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_files.o \\  
                src/os/unix/ngx\_files.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_socket.o \\  
                src/os/unix/ngx\_socket.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_recv.o \\  
                src/os/unix/ngx\_recv.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_readv\_chain.o \\  
                src/os/unix/ngx\_readv\_chain.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_udp\_recv.o \\  
                src/os/unix/ngx\_udp\_recv.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_send.o \\  
                src/os/unix/ngx\_send.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_writev\_chain.o \\  
                src/os/unix/ngx\_writev\_chain.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_channel.o \\  
                src/os/unix/ngx\_channel.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_shmem.o \\  
                src/os/unix/ngx\_shmem.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_process.o \\  
                src/os/unix/ngx\_process.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_daemon.o \\  
                src/os/unix/ngx\_daemon.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_setaffinity.o \\  
                src/os/unix/ngx\_setaffinity.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_setproctitle.o \\  
                src/os/unix/ngx\_setproctitle.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_posix\_init.o \\  
                src/os/unix/ngx\_posix\_init.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_user.o \\  
                src/os/unix/ngx\_user.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_process\_cycle.o \\  
                src/os/unix/ngx\_process\_cycle.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_linux\_init.o \\  
                src/os/unix/ngx\_linux\_init.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/event/modules/ngx\_epoll\_module.o \\  
                src/event/modules/ngx\_epoll\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/os/unix/ngx\_linux\_sendfile\_chain.o \\  
                src/os/unix/ngx\_linux\_sendfile\_chain.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/src/core/ngx\_regex.o \\  
                src/core/ngx\_regex.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/ngx\_http.o \\  
                src/http/ngx\_http.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/ngx\_http\_core\_module.o \\  
                src/http/ngx\_http\_core\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/ngx\_http\_special\_response.o \\  
                src/http/ngx\_http\_special\_response.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/ngx\_http\_request.o \\  
                src/http/ngx\_http\_request.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/ngx\_http\_parse.o \\  
                src/http/ngx\_http\_parse.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/ngx\_http\_header\_filter\_module.o \\  
                src/http/ngx\_http\_header\_filter\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/ngx\_http\_write\_filter\_module.o \\  
                src/http/ngx\_http\_write\_filter\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/ngx\_http\_copy\_filter\_module.o \\  
                src/http/ngx\_http\_copy\_filter\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_log\_module.o \\  
                src/http/modules/ngx\_http\_log\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/ngx\_http\_request\_body.o \\  
                src/http/ngx\_http\_request\_body.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/ngx\_http\_variables.o \\  
                src/http/ngx\_http\_variables.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/ngx\_http\_script.o \\  
                src/http/ngx\_http\_script.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/ngx\_http\_upstream.o \\  
                src/http/ngx\_http\_upstream.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/ngx\_http\_upstream\_round\_robin.o \\  
                src/http/ngx\_http\_upstream\_round\_robin.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/ngx\_http\_parse\_time.o \\  
                src/http/ngx\_http\_parse\_time.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_static\_module.o \\  
                src/http/modules/ngx\_http\_static\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_index\_module.o \\  
                src/http/modules/ngx\_http\_index\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_chunked\_filter\_module.o \\  
                src/http/modules/ngx\_http\_chunked\_filter\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_range\_filter\_module.o \\  
                src/http/modules/ngx\_http\_range\_filter\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_headers\_filter\_module.o \\  
                src/http/modules/ngx\_http\_headers\_filter\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_not\_modified\_filter\_module.o \\  
                src/http/modules/ngx\_http\_not\_modified\_filter\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/ngx\_http\_busy\_lock.o \\  
                src/http/ngx\_http\_busy\_lock.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/ngx\_http\_file\_cache.o \\  
                src/http/ngx\_http\_file\_cache.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_gzip\_filter\_module.o \\  
                src/http/modules/ngx\_http\_gzip\_filter\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/ngx\_http\_postpone\_filter\_module.o \\  
                src/http/ngx\_http\_postpone\_filter\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_ssi\_filter\_module.o \\  
                src/http/modules/ngx\_http\_ssi\_filter\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_charset\_filter\_module.o \\  
                src/http/modules/ngx\_http\_charset\_filter\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_userid\_filter\_module.o \\  
                src/http/modules/ngx\_http\_userid\_filter\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_autoindex\_module.o \\  
                src/http/modules/ngx\_http\_autoindex\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_auth\_basic\_module.o \\  
                src/http/modules/ngx\_http\_auth\_basic\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_access\_module.o \\  
                src/http/modules/ngx\_http\_access\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_limit\_conn\_module.o \\  
                src/http/modules/ngx\_http\_limit\_conn\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_limit\_req\_module.o \\  
                src/http/modules/ngx\_http\_limit\_req\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_geo\_module.o \\  
                src/http/modules/ngx\_http\_geo\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_map\_module.o \\  
                src/http/modules/ngx\_http\_map\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_split\_clients\_module.o \\  
                src/http/modules/ngx\_http\_split\_clients\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_referer\_module.o \\  
                src/http/modules/ngx\_http\_referer\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_rewrite\_module.o \\  
                src/http/modules/ngx\_http\_rewrite\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_proxy\_module.o \\  
                src/http/modules/ngx\_http\_proxy\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_fastcgi\_module.o \\  
                src/http/modules/ngx\_http\_fastcgi\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_uwsgi\_module.o \\  
                src/http/modules/ngx\_http\_uwsgi\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_scgi\_module.o \\  
                src/http/modules/ngx\_http\_scgi\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_memcached\_module.o \\  
                src/http/modules/ngx\_http\_memcached\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_empty\_gif\_module.o \\  
                src/http/modules/ngx\_http\_empty\_gif\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_browser\_module.o \\  
                src/http/modules/ngx\_http\_browser\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_upstream\_ip\_hash\_module.o \\  
                src/http/modules/ngx\_http\_upstream\_ip\_hash\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \\  
                -o objs/src/http/modules/ngx\_http\_upstream\_keepalive\_module.o \\  
                src/http/modules/ngx\_http\_upstream\_keepalive\_module.c  
gcc -c  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\  
                -o objs/ngx\_modules.o \\  
                objs/ngx\_modules.c  
gcc -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\_hash.o \\  
        objs/src/core/ngx\_buf.o \\  
        objs/src/core/ngx\_queue.o \\  
        objs/src/core/ngx\_output\_chain.o \\  
        objs/src/core/ngx\_string.o \\  
        objs/src/core/ngx\_parse.o \\  
        objs/src/core/ngx\_inet.o \\  
        objs/src/core/ngx\_file.o \\  
        objs/src/core/ngx\_crc32.o \\  
        objs/src/core/ngx\_murmurhash.o \\  
        objs/src/core/ngx\_md5.o \\  
        objs/src/core/ngx\_rbtree.o \\  
        objs/src/core/ngx\_radix\_tree.o \\  
        objs/src/core/ngx\_slab.o \\  
        objs/src/core/ngx\_times.o \\  
        objs/src/core/ngx\_shmtx.o \\  
        objs/src/core/ngx\_connection.o \\  
        objs/src/core/ngx\_cycle.o \\  
        objs/src/core/ngx\_spinlock.o \\  
        objs/src/core/ngx\_cpuinfo.o \\  
        objs/src/core/ngx\_conf\_file.o \\  
        objs/src/core/ngx\_resolver.o \\  
        objs/src/core/ngx\_open\_file\_cache.o \\  
        objs/src/core/ngx\_crypt.o \\  
        objs/src/event/ngx\_event.o \\  
        objs/src/event/ngx\_event\_timer.o \\  
        objs/src/event/ngx\_event\_posted.o \\  
        objs/src/event/ngx\_event\_busy\_lock.o \\  
        objs/src/event/ngx\_event\_accept.o \\  
        objs/src/event/ngx\_event\_connect.o \\  
        objs/src/event/ngx\_event\_pipe.o \\  
        objs/src/os/unix/ngx\_time.o \\  
        objs/src/os/unix/ngx\_errno.o \\  
        objs/src/os/unix/ngx\_alloc.o \\  
        objs/src/os/unix/ngx\_files.o \\  
        objs/src/os/unix/ngx\_socket.o \\  
        objs/src/os/unix/ngx\_recv.o \\  
        objs/src/os/unix/ngx\_readv\_chain.o \\  
        objs/src/os/unix/ngx\_udp\_recv.o \\  
        objs/src/os/unix/ngx\_send.o \\  
        objs/src/os/unix/ngx\_writev\_chain.o \\  
        objs/src/os/unix/ngx\_channel.o \\  
        objs/src/os/unix/ngx\_shmem.o \\  
        objs/src/os/unix/ngx\_process.o \\  
        objs/src/os/unix/ngx\_daemon.o \\  
        objs/src/os/unix/ngx\_setaffinity.o \\  
        objs/src/os/unix/ngx\_setproctitle.o \\  
        objs/src/os/unix/ngx\_posix\_init.o \\  
        objs/src/os/unix/ngx\_user.o \\  
        objs/src/os/unix/ngx\_process\_cycle.o \\  
        objs/src/os/unix/ngx\_linux\_init.o \\  
        objs/src/event/modules/ngx\_epoll\_module.o \\  
        objs/src/os/unix/ngx\_linux\_sendfile\_chain.o \\  
        objs/src/core/ngx\_regex.o \\  
        objs/src/http/ngx\_http.o \\  
        objs/src/http/ngx\_http\_core\_module.o \\  
        objs/src/http/ngx\_http\_special\_response.o \\  
        objs/src/http/ngx\_http\_request.o \\  
        objs/src/http/ngx\_http\_parse.o \\  
        objs/src/http/ngx\_http\_header\_filter\_module.o \\  
        objs/src/http/ngx\_http\_write\_filter\_module.o \\  
        objs/src/http/ngx\_http\_copy\_filter\_module.o \\  
        objs/src/http/modules/ngx\_http\_log\_module.o \\  
        objs/src/http/ngx\_http\_request\_body.o \\  
        objs/src/http/ngx\_http\_variables.o \\  
        objs/src/http/ngx\_http\_script.o \\  
        objs/src/http/ngx\_http\_upstream.o \\  
        objs/src/http/ngx\_http\_upstream\_round\_robin.o \\  
        objs/src/http/ngx\_http\_parse\_time.o \\  
        objs/src/http/modules/ngx\_http\_static\_module.o \\  
        objs/src/http/modules/ngx\_http\_index\_module.o \\  
        objs/src/http/modules/ngx\_http\_chunked\_filter\_module.o \\  
        objs/src/http/modules/ngx\_http\_range\_filter\_module.o \\  
        objs/src/http/modules/ngx\_http\_headers\_filter\_module.o \\  
        objs/src/http/modules/ngx\_http\_not\_modified\_filter\_module.o \\  
        objs/src/http/ngx\_http\_busy\_lock.o \\  
        objs/src/http/ngx\_http\_file\_cache.o \\  
        objs/src/http/modules/ngx\_http\_gzip\_filter\_module.o \\  
        objs/src/http/ngx\_http\_postpone\_filter\_module.o \\  
        objs/src/http/modules/ngx\_http\_ssi\_filter\_module.o \\  
        objs/src/http/modules/ngx\_http\_charset\_filter\_module.o \\  
        objs/src/http/modules/ngx\_http\_userid\_filter\_module.o \\  
        objs/src/http/modules/ngx\_http\_autoindex\_module.o \\  
        objs/src/http/modules/ngx\_http\_auth\_basic\_module.o \\  
        objs/src/http/modules/ngx\_http\_access\_module.o \\  
        objs/src/http/modules/ngx\_http\_limit\_conn\_module.o \\  
        objs/src/http/modules/ngx\_http\_limit\_req\_module.o \\  
        objs/src/http/modules/ngx\_http\_geo\_module.o \\  
        objs/src/http/modules/ngx\_http\_map\_module.o \\  
        objs/src/http/modules/ngx\_http\_split\_clients\_module.o \\  
        objs/src/http/modules/ngx\_http\_referer\_module.o \\  
        objs/src/http/modules/ngx\_http\_rewrite\_module.o \\  
        objs/src/http/modules/ngx\_http\_proxy\_module.o \\  
        objs/src/http/modules/ngx\_http\_fastcgi\_module.o \\  
        objs/src/http/modules/ngx\_http\_uwsgi\_module.o \\  
        objs/src/http/modules/ngx\_http\_scgi\_module.o \\  
        objs/src/http/modules/ngx\_http\_memcached\_module.o \\  
        objs/src/http/modules/ngx\_http\_empty\_gif\_module.o \\  
        objs/src/http/modules/ngx\_http\_browser\_module.o \\  
        objs/src/http/modules/ngx\_http\_upstream\_ip\_hash\_module.o \\  
        objs/src/http/modules/ngx\_http\_upstream\_keepalive\_module.o \\  
        objs/ngx\_modules.o \\  
        -lpthread -lcrypt -lpcre -lz  
make\[1]: Leaving directory \`/root/setup/nginx/nginx-1.2.1'  
make -f objs/Makefile manpage  
make\[1]: Entering directory \`/root/setup/nginx/nginx-1.2.1'  
sed -e "s|%%PREFIX%%|/opt/nginx|" \\  
                -e "s|%%PID\_PATH%%|/opt/nginx/logs/nginx.pid|" \\  
                -e "s|%%CONF\_PATH%%|/opt/nginx/conf/nginx.conf|" \\  
                -e "s|%%ERROR\_LOG\_PATH%%|/opt/nginx/logs/error.log|" \\  
                &lt; man/nginx.8 &gt; objs/nginx.8  
make\[1]: Leaving directory \`/root/setup/nginx/nginx-1.2.1'  
make -f objs/Makefile install  
make\[1]: Entering directory \`/root/setup/nginx/nginx-1.2.1'  
test -d '/opt/nginx' || mkdir -p '/opt/nginx'  
test -d '/opt/nginx/sbin'               || mkdir -p '/opt/nginx/sbin'  
test ! -f '/opt/nginx/sbin/nginx'               || mv '/opt/nginx/sbin/nginx'                   '/opt/nginx/sbin/nginx.old'  
cp objs/nginx '/opt/nginx/sbin/nginx'  
test -d '/opt/nginx/conf'               || mkdir -p '/opt/nginx/conf'  
cp conf/koi-win '/opt/nginx/conf'  
cp conf/koi-utf '/opt/nginx/conf'  
cp conf/win-utf '/opt/nginx/conf'  
test -f '/opt/nginx/conf/mime.types'            || cp conf/mime.types '/opt/nginx/conf'  
cp conf/mime.types '/opt/nginx/conf/mime.types.default'  
test -f '/opt/nginx/conf/fastcgi\_params'                || cp conf/fastcgi\_params '/opt/nginx/conf'  
cp conf/fastcgi\_params          '/opt/nginx/conf/fastcgi\_params.default'  
test -f '/opt/nginx/conf/fastcgi.conf'          || cp conf/fastcgi.conf '/opt/nginx/conf'  
cp conf/fastcgi.conf '/opt/nginx/conf/fastcgi.conf.default'  
test -f '/opt/nginx/conf/uwsgi\_params'          || cp conf/uwsgi\_params '/opt/nginx/conf'  
cp conf/uwsgi\_params            '/opt/nginx/conf/uwsgi\_params.default'  
test -f '/opt/nginx/conf/scgi\_params'           || cp conf/scgi\_params '/opt/nginx/conf'  
cp conf/scgi\_params             '/opt/nginx/conf/scgi\_params.default'  
test -f '/opt/nginx/conf/nginx.conf'            || cp conf/nginx.conf '/opt/nginx/conf/nginx.conf'  
cp conf/nginx.conf '/opt/nginx/conf/nginx.conf.default'  
test -d '/opt/nginx/logs'               || mkdir -p '/opt/nginx/logs'  
test -d '/opt/nginx/logs' ||            mkdir -p '/opt/nginx/logs'  
test -d '/opt/nginx/html'               || cp -R html '/opt/nginx'  
test -d '/opt/nginx/logs' ||            mkdir -p '/opt/nginx/logs'  
make\[1]: Leaving directory \`/root/setup/nginx/nginx-1.2.1'  
\[root@www nginx-1.2.1]$

 

本文地址：[http://codingstandards.iteye.com/blog/1560835](/blog/1560835)

\[root@www nginx-1.2.1]$  
\[root@www nginx-1.2.1]$ cd /opt/nginx/  
\[root@www nginx]$ tree  
.  
|-- conf  
|   |-- fastcgi.conf  
|   |-- fastcgi.conf.default  
|   |-- fastcgi\_params  
|   |-- fastcgi\_params.default  
|   |-- koi-utf  
|   |-- koi-win  
|   |-- mime.types  
|   |-- mime.types.default  
|   |-- nginx.conf  
|   |-- nginx.conf.default  
|   |-- scgi\_params  
|   |-- scgi\_params.default  
|   |-- uwsgi\_params  
|   |-- uwsgi\_params.default  
|   \`-- win-utf  
|-- html  
|   |-- 50x.html  
|   \`-- index.html  
|-- logs  
\`-- sbin  
    \`-- nginx

4 directories, 18 files  
\[root@www nginx]$