renguifeng 发布的文章
护理评估单
使用winSW把Nginx配置成Windows服务
<service> <id>nginx</id> <name>nginx</name> <description>nginx</description> <executable>c:\nginx\nginx.exe</executable> <logpath>c:\nginx\logs</logpath> <logmode>roll</logmode> <depend></depend> <startargument>-p</startargument> <startargument>c:\nginx</startargument> <stopexecutable>c:\nginx\nginx.exe</stopexecutable> <stopargument>-p</stopargument> <stopargument>c:\nginx</stopargument> <stopargument>-s</stopargument> <stopargument>stop</stopargument></service>
install install the service to Windows Service Controlleruninstall uninstall the service
start start the service (must be installed before)
stop stop the service
stopwait stop the service and wait until it's actually stopped
restart restart the service
restart! self-restart (can be called from child processes)
status check the current status of the service
test check if the service can be started and then stopped
testwait starts the service and waits until a key is pressed then stops the service
version print the version info
help print the help info (aliases: -h,--help,-?,/?)
<br/>
Nginx配置fastcgi配置
https://segmentfault.com/a/1190000002667095
fastcgi_index
作用域:http, server, location
当请求以/
结尾的时候,会将请求传递给所设置的index.php文件处理。
fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/www/scripts/php$fastcgi_script_name;
fastcgi_split_path_info
作用域:location
Nginx默认获取不到PATH_INFO的值,得通过fastcgi_split_path_info指定定义的正则表达式来给$fastcgi_path_info
赋值。
其正则表达式必须要有两个捕获。
第一个捕获的值会重新赋值给
$fastcgi_script_name
变量。第二个捕获到的值会重新赋值给
$fastcgi_path_info
变量。
例子:
location ~ ^(.+\.php)(.*)$ { fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param SCRIPT_FILENAME /path/to/php$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info;}
原始请求是 /show.php/article/0001
。
通过分割,FastCGI得到的结果是:
SCRIPT_FILENAME:
/path/to/php/show.php
PATH_INFO:
/article/0001
Nginx在0.7.31以前是没有fastcgi_split_path_info这个指令的,而0.7.x这个版本一直存活了好多年,后面才高歌猛进,导致网上存在大量旧版本通过正则自己设置PATH_INFO的方法。
<br/>