cygwin 安装nginx

//下载
wget http://nginx.org/download/nginx-1.7.6.tar.gz

tar -xzvf nginx-1.7.6.tar.gz
http://blog.csdn.net/dyllove98/article/details/8892509
//安装gcc
setup-x86_64.exe -q -P make
setup-x86_64.exe -q -P gcc-g++

//zlib
http://www.zlib.net/
[root@localhost mrms]# tar -zxvf zlib-1.2.7.tar.gz

[root@localhost mrms]# cd zlib-1.2.7

[root@localhost zlib-1.2.7]# ./configure 

[root@localhost zlib-1.2.7]# make

[root@localhost zlib-1.2.7]# make install

//pcre
http://www.pcre.org/
手动下载安装
[root@localhost mrms]# tar -zxvf pcre-8.21.tar.gz

[root@localhost mrms]# cd pcre-8.21

[root@localhost pcre-8.21]# ./configure 

[root@localhost pcre-8.21]# make

[root@localhost pcre-8.21]# make install

//http://www.openssl.org/source/


//安装
cd  nginx-1.7.6

$ ./configure --with-pcre=../pcre-8.36 --with-zlib=../zlib-1.2.8
checking for OS
 + CYGWIN_NT-6.1 1.7.32(0.274/5/3) x86_64
checking for C compiler ... found
 + using GNU C compiler
 + gcc version: 4.8.3 (GCC)
checking for gcc -pipe switch ... found
checking for gcc builtin atomic operations ... 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 ... not found
checking for CYGWIN_NT-6.1 specific features
checking for nobody group ... not found
checking for nogroup group ... not 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 ... not 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() ... not found
checking for statvfs() ... found
checking for dlopen() ... found
checking for sched_yield() ... found
checking for SO_SETFIB ... not found
checking for SO_ACCEPTFILTER ... not found
checking for TCP_DEFER_ACCEPT ... not found
checking for TCP_KEEPIDLE ... not found
checking for TCP_FASTOPEN ... not found
checking for TCP_INFO ... not found
checking for accept4() ... found
checking for int size ... 4 bytes
checking for long size ... 8 bytes
checking for long long 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
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 byte ordering ... little endian
checking for size_t size ... 8 bytes
checking for off_t size ... 8 bytes
checking for time_t size ... 8 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 ... not found
checking for POSIX semaphores ... 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 getaddrinfo() ... found
checking for md5 in system md library ... not found
checking for md5 in system md5 library ... not found
checking for md5 in system OpenSSL crypto library ... not found
checking for sha1 in system md library ... not found
checking for sha1 in system OpenSSL crypto library ... not found
creating objs/Makefile

Configuration summary
  + using PCRE library: ../pcre-8.36
  + OpenSSL library is not used
  + using builtin md5 code
  + sha1 library is not found
  + using zlib library: ../zlib-1.2.8

  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/nginx/sbin/nginx"
  nginx configuration prefix: "/usr/local/nginx/conf"
  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"
  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@localhost nginx-1.2.6]# make && make install


出现crypy错误,看下面老外安装的过程
估计需要安装devel下面的包




3 - Installing Cygwin

Run setup.exe and hit "Next" 6 times (you want "Install from Internet", choose the mirror of your choice). You will arrive at a huge list of packages to choose from. Tip: you can maximize that window.

To select a package, click in the "New" column (it cycles through Skip, Keep, Uninstall, etc.). When a version number is displayed, it will be installed.

Select these additional packages (dependencies for these packages will be automatically selected):

Admin/cygrunsrv
Devel/autoconf
Devel/automake
Devel/bison
Devel/curl-devel
Devel/flex
Devel/gcc
Devel/libiconv
Devel/libmcrypt-devel
Devel/libtool
Devel/libxml2
Devel/libxml2-devel
Devel/make
Devel/patchutils
Devel/pcre
Devel/pcre-devel
Editors/vim
Libs/jpeg
Libs/libmcrypt

Then hit "Next" to install. Tip: you can run setup.exe anytime to add or remove packages.

NOTE: these packages are those I needed for my own Nginx, MySQL and PHP ./configure's options. If your ./configure's options differ from mine, you may need to select additional packages or your ./configure's will fail for missing dependencies.

--

Now that Cygwin is installed, run c:\cygwin\Cygwin.bat to get a shell Window. Your home directory (c:\cygwin\home\Administrator) will be created and prepared.

Copy the following files in c:\cygwin\home\Administrator:

nginx-0.6.32.tar.gz
mysql-5.0.67.tar.gz
php-5.2.6.tar.gz
php-5.2.6-fpm-0.5.8.diff.gz
getaddrinfo-1.6.3.tar.gz

4 - Installing Nginx under Cygwin

Open Cygwin and extract nginx-0.6.32.tar.gz:

cd
tar xvfz nginx-0.6.32.tar.gz
cd nginx-0.6.32

Now, configure Nginx:

./configure --with-http_ssl_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module

And finally, compile and install Nginx:

make
make install

--

Now we will prepare our "www" directory:

mkdir /www

As well as our Nginx configuration:

/usr/local/nginx/conf/nginx.conf:

worker_processes  5;



events {

  worker_connections  64; # VERY important. Do not leave 1024 there.

}



http {

  include       mime.types;

  default_type  application/octet-stream;



  sendfile        on;



  keepalive_timeout  65;



  server {

    listen       80;

    server_name  localhost;



    location / {

      root   /www;

      index  index.php index.html;

    }



    location ~ \.php$ {

      root   /www;



      fastcgi_pass   127.0.0.1:9000;

      fastcgi_index  index.php;

      fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

      include        fastcgi_params;

    }

  }

}


You may adjust this configuration file to suit your needs.
http://www.softwareprojects.com/resources/programming/t-how-to-install-nginx-php-php-fpm-and-mysql-under-1616.html


配置文件

/usr/local/nginx/conf/nginx.conf

启动命令
/usr/local/nginx/sbin/nginx


   2008/01/12 16:34:56 [emerg] 2496#0: the maximum number of files supported by select() is 64的错误提示,这表示FD_SETSIZE的值比nginx配置文件中worker_connections指令所指定的值,你可以把nginx.conf里的worker_connections选项改小一些,比如44,加了--with-cc-opt=”-D FD_SETSIZE=4096”后就不会碰到这问题

猜你喜欢

转载自powertech.iteye.com/blog/2126745