4nginx设置FastCGI代理-阅读官方文档
Posted 丸子酱酱酱
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了4nginx设置FastCGI代理-阅读官方文档相关的知识,希望对你有一定的参考价值。
翻译部分:Setting Up FastCGI Proxying
tips: FastCGI是一个协议
开始!
nginx can be used to route requests to FastCGI servers which run applications built with various frameworks and programming languages such as php.
nginx可以用来路由请求到用各种各样的框架和编程语言建立的FastCGI服务器上。
The most basic nginx configuration to work with a FastCGI server includes using the fastcgi_pass directive instead of the
proxy_pass
directive, and fastcgi_param directives to set parameters passed to a FastCGI server.
能够和FastCGI服务器工作最基本的nginx配置包括fastcgi_pass,fastcgi_param指令。
fastcgi_param设置传给FastCGI服务器的参数。
Suppose the FastCGI server is accessible on
localhost:9000
.
假设在localhost:9000上可以访问到
FastCGI服务器。
Taking the proxy configuration from the previous section as a basis, replace the
proxy_pass
directive with thefastcgi_pass
directive and change the parameter tolocalhost:9000
.
将之前那些部分的demo:proxy_pass http://localhost:8080/; 修改成下面这样
fastcgi_pass localhost:9000;
In PHP, the
SCRIPT_FILENAME
parameter is used for determining the script name, and theQUERY_STRING
parameter is used to pass request parameters.
在PHP中,SCRIPT_FILENAME参数用来决定脚本名称
QUERY_STRING参数用来传递请求参数
The resulting configuration would be:
server { location / { fastcgi_pass localhost:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param QUERY_STRING $query_string; } location ~ \\.(gif|jpg|png)$ { root /data/images; } }
最终配置文件长这样。
This will set up a server that will route all requests except for requests for static images to the proxied server operating on
localhost:9000
through the FastCGI protocol.
上面的配置会设置一个服务器,它会通过FastCGI协议,路由除静态文件请求以外的请求到跑在localhost:9000
上的被代理服务器。
以上是关于4nginx设置FastCGI代理-阅读官方文档的主要内容,如果未能解决你的问题,请参考以下文章
Qt文档阅读笔记-QNetworkProxy::ProxyType解析(Qt设置Fiddler代理)