run nginx in windows

内容来自: http://nginx.org/en/docs/windows.html

nginx/Windows uses the native Win32 API (not the Cygwin emulation level). Currently only the select method is used as a notification way, therefore you should not expect high performance and scalability. Because of this and some known issues nginx/Windows is considered as a beta version. There is almost full-functionality in nginx/Windows as in Unix version, except XSLT filter, image filter, GeoIP module, and embedded Perl language.

To install nginx/Windows, you should download the latest 0.8.32 development version zipped file, since the development branch contains all known fixes, especially Windows related. Then you should unzip the file, go to the nginx-0.8.32 directory, and run nginx. Here is an example for the drive C: root directory:

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

You may run the “tasklist” command line utility to see nginx processes:

    C:\nginx-0.8.32>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 have not started, you should look in the “logs\error.log” file for the reason. If the log file has not been created, the reason should be reported in Windows Event Log. If you see an error page instead of the expected page, you should also look in the “logs\error.log” file for the error reason.

nginx/Windows uses the directory where it has been run as the prefix directory for relative paths in the configuration. In the example above, the prefix directory is “C:\nginx-0.8.32\”. Paths in the configuration must be set in Unix style using slashes:

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

nginx/Windows runs as an usual application, not a service, and it can be managed using the following commands:

    nginx -s stop quick exit
    nginx -s quit graceful quit
    nginx -s reload changing configuration, starting a new worker, quitting gracefully an old worker
    nginx -s reopen reopening log files

Known issues

    * Although several workers can be run, only one of them works actually.
    * A worker can handle no more than 1024 simultaneous connections.
    * The cache and other modules requires a shared memory support do not work in Windows Vista and later due to address space layout randomization enabled in these Windows versions.

Possible future enhancements

    * Running as a service.
    * Using the I/O completion ports as notification method.
    * Using the worker threads inside single worker.

你可能感兴趣的:(C++,c,nginx,windows,C#)