Cygwin won't talk much about nginx installation. PCRE and zlib are required. I have installed version 1.2.6 here. Because it is a windows environment, I need to modify the master configuration worker_connections to 64 or lower. If it exceeds 64, an error is reported, you can solve the problem as follows.
• Remove the ngx_select_module event processing module by specifying the parameter-without-select_module when you execute configure.
• Modify the nginx configuration file (c: nginxconfnginx. conf) and change 13th of the file's 1024 rows to 64 (worker_connections command value ).
• Specify additional compilation options (-with-cc-opt = "-D FD_SETSIZE = 2048") when executing configure, which can also solve the problem above.
The key lies in how to load cgi. A foreigner has an article on installing php-fpm which will be detailed and translated. The article needs to modify multiple source code files, I am too lazy to search for the specific article address. In this case, php-fpmand php-cgi.exe can achieve similar functionality, test environment performance can be completely ignored, php-cgi-B: 9000-c D: Program Filesphp-5.3.10-Win32-VC9-x86php.ini listen to Port 9000.
Paste a common PHP cgi call here. You can directly include the file where php needs to be parsed.
Conf/php5
The code is as follows: |
Copy code |
Location ~ *. Php ($ | /){ Include fastcgi_params; Fastcgi_pass 127.0.0.1: 9000; Fastcgi_param SCRIPT_FILENAME $ winPath $ fastcgi_script_name; Fastcgi_param SERVER_NAME $ server_name; Fastcgi_param PATH_INFO $ fastcgi_script_name; } |
$ WinPath is set in the upper-layer configuration, and $ document_root is in cygwin format. It should be the path set by root. However, in windows (PHP is not installed in cygwin), PHP only knows the path in windows format, so you need to set this path separately.
The code is as follows: |
Copy code |
Conf/conf. d/test. conf Server { Listen 80; Server_name test; Root/cygdrive/e/document/www_root/test; Set $ winPath e:/document/www_root/test; Location /{ } Include php5; } |
Convert php-cgi to daemon mode
The web server environment is okay, but every time the cgi window is opened, and manual start is required to start the system.
Cygwin can install the program as a windows system service, so that it can run in the background and start automatically. The cgi parameters are wide-eyed.
The code is as follows: |
Copy code |
$ Cygrunsrv-I php-fcgi-p/cygdrive/d/Program Files/php-5.3.10-Win32-VC9-x86/php-cgi.exe-a "-B 127.0.0.1: 9000-c" D: Program Filesphp-5.3.10-Win32-VC9-x86php.ini "" $ Cygrunsrv-S php-fcgi |
Although in cygwin, php-cgi.exe is essentially a windows program, so-c cannot use the path in cygwin format.
You can also use the bat script to enable automatic startup.