1. LAMP

Nginx第一话 [For Win]

最近看农场主http://www.yanshiba.com/的MySQL视频,感觉要被十八哥圈粉了,哈哈。

言归正传,这是搬到wp的第一篇文章,就当测试一下了!

正文:Nginx (engine x) 是毛子写的是一个高性能的HTTP反向代理服务,也是一个IMAP/POP3/SMTP服务。

Nginx是一款轻量级Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行。其特点是占有内存少,并发能力强,事实上nginx的并发能力确实在同类型的网页服务器中表现较好,中国大陆使用nginx网站用户有:百度、京东新浪网易腾讯淘宝等。 —-百度百科

说的真好,我选Apache(滑稽。

先去官网:http://nginx.org/en/download.html

下载最新的Win版本(我不当党员谁当?)

 

这是解压好的效果

  1. conf:配置文件
  2. contrib:里面存了一些perl脚本
  3. docs:文档
  4. html:网页文件存在这里
  5. logs:存放日志
  6. temp:存放临时文件

cmd到相应目录

执行nginx.exe……OK!

效果图如上

附赠Win详细文档,洋文好的人多得很呐!

Version of nginx for Windows uses the native Win32 API (not the Cygwin emulation layer). Only the select() connection processing method is currently used, so high performance and scalability should not be expected. Due to this and some other known issues version of nginx for Windows is considered to be a beta version. At this time, it provides almost the same functionality as a UNIX version of nginx except for XSLT filter, image filter, GeoIP module, and embedded Perl language.

To install nginx/Windows, download the latest mainline version distribution (1.15.2), since the mainline branch of nginx contains all known fixes. Then unpack the distribution, go to the nginx-1.15.2 directory, and run nginx. Here is an example for the drive C: root directory:

cd c:\
unzip nginx-1.15.2.zip
cd nginx-1.15.2
start nginx

Run the tasklist command-line utility to see nginx processes:

C:\nginx-1.15.2>tasklist /fi "imagename eq nginx.exe"

Image Name           PID Session Name     Session#    Mem Usage
=============== ======== ============== ========== ============
nginx.exe            652 Console                 0      2 780 K
nginx.exe           1332 Console                 0      3 112 K

One of the processes is the master process and another is the worker process. If nginx does not start, look for the reason in the error log file logs\error.log. If the log file has not been created, the reason for this should be reported in the Windows Event Log. If an error page is displayed instead of the expected page, also look for the reason in the logs\error.log file.

nginx/Windows uses the directory where it has been run as the prefix for relative paths in the configuration. In the example above, the prefix is C:\nginx-1.15.2\. Paths in a configuration file must be specified in UNIX-style using forward slashes:

access_log   logs/site.log;
root         C:/web/html;

nginx/Windows runs as a standard console application (not a service), and it can be managed using the following commands:

nginx -s stop fast shutdown
nginx -s quit graceful shutdown
nginx -s reload changing configuration, starting new worker processes with a new configuration, graceful shutdown of old worker processes
nginx -s reopen re-opening log files

 

Known issues

 

  • Although several workers can be started, only one of them actually does any work.
  • A worker can handle no more than 1024 simultaneous connections.
  • The UDP proxy functionality is not supported.

 

 

Possible future enhancements

 

  • Running as a service.
  • Using the I/O completion ports as a connection processing method.
  • Using multiple worker threads inside a single worker process.

下一话Linux版我会详细说一说这些命令。

 

官方文档:http://nginx.org/en/docs/

 

END