Nginx windows usage)

Source: Internet
Author: User
Tags geoip image filter xslt

 

Nginx windows usage)

Http://nginx.org/en/docs/windows.html

Translator's blog: http://blog.csdn.net/kimsoft

2010/12/23

 

Nginx/Windows uses the native WIN32API (non-cygwin simulation Layer ). Currently onlySelectMethods are used as notification methods, so you do not have to deal with high performance and scalability requirements. Due to this and some known problems, nginx/Windows is considered as beta. Compared with the unix version, the XSLT filter, image filter, geoip module, and built-in Perl language have almost all functions.

 

To install nginx/Windows, you should download the latest 0.9.3 development package, because this development branch contains all known problems, especially windows-related problems. Decompress the file, go to the nginx-0.9.3 directory, and run nginx. For disk C as the root directory, here is an example:

Cd c :/

Unzipnginx-0.9.3.zip

Cdnginx-0.9.3

Start nginx

 

You can run the "tasklist" command line tool to view nginx processes:

C:/nginx-0.9.3>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 main process and the other is the working process. If nginx is not started, check "logs/error. log" to find the cause. If this log file is not created, the cause of the error should already be in Windows
Event Logs are reported. If you see an error page instead of the expected page, you should also find the cause of the error in the "logs/error. log" file.

 

In the configuration, nginx/Windows uses the prefix directory to be run as the relative directory. In the preceding example, the prefix directory is "C:/nginx-0.9.3 /". The path in the configuration file should be set to the UNIX style with the Slash:

Access_log
Logs/site. log;

Root C:/web/html;

 

The nginx/Windows version runs as a standard console, rather than a service, and can be managed using the following commands:

Nginx-s stop
Quick exit

Nginx-squit
Exit elegantly

Nginx-sreload: change the configuration, start a new working process, and exit the old process elegantly

Nginx-sreopen re-open the log file

Known issues

L although multiple worker processes can be run, only one actually works.

L a worker process can process up to 1024 concurrent connections.

L caching and other modules that require shared memory support do not work in Windows Vista and later versions, because address space layout in these Windows versions is randomly enabled.

 

Possible enhancements in the future

L run as a service.

L use I/O to complete the port as the notification method.

L use multiple working threads to replace a single working process.

 

Added:

Nginx has great advantages in UNIX like systems. We recommend that you deploy the production environment on UNIX like systems.

Disadvantages in Windows:

N select model is inefficient (epoll and other efficient models are available in Linux)

Limits on N 1 worker process. Multiple worker processes can be enabled in UNIX like system.

N concurrent connections are limited to 1024
Below

N cache and shared memory problems

N missing modules and functions (Part 1 of the translation, XSLT filter, image filter, geoip module, and built-in Perl language)

N cannot run as a service (there is a solution on the Internet, but it is still inconvenient)

N log segmentation (logrotate in the unixlike system is easy to solve). In Windows, you can use the following method:

U write a batch. It already exists on the Internet, but you need to stop nginx and run it with a scheduled task.

U batch processing is not easy to write. You can use python to write a small script and run it with a scheduled task.

U configure access_logoff to disable logs

 

Windows Command Line usage reference:

Nginx: nginx version: nginx/0.9.3

Nginx: Usage: nginx [-? Hvvtq] [-S Signal] [-C filename] [-P prefix] [-G directives]

 

Options:

-?, -H
: This help (note /? Is different, UNIX style)

-V
: Show version and exit

-V
: Show version and configure options then exit

-T
: Test Configuration and exit (test configuration file, easy to use)

-Q
: Suppress non-error messages during configuration testing

-S Signal
: Send signal to a master process: Stop, quit, reopen, reload (as described above)

-P prefix
: Set prefix path (default: None)

-C filename
: Set configuration file (default: CONF/nginx. conf) (changing the configuration file makes it useless)

-G directives
: Set global directives out of configuration file

 

Nginx resources:

Http://nginx.org/

Chinese wiki:
Http://wiki.nginx.org/Chs

Zhang Xiaoming's blog:
Http://blog.s135.com/post/366/

 

 


 

Document: http://download.csdn.net/source/2933573

 

Telecommunications direct download: http://dl5.csdn.net/fd.php? I = 784829335739562 & s = f206d056ba5cef299ce41f0cb94938f6

Netcom direct download: http://dl5.csdn.net/fd.php? I = 566429335739788 & s = 7c96dfd6c5f559f1bb12a162c9d6ac69

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.