对于上述nginx配置文件若想每个location块都用 fastcgi标准,又该如何处理上述问题呢
时间: 2023-07-18 11:43:47 浏览: 46
如果你想让每个location块都使用fastcgi标准,可以在http块中设置fastcgi参数,然后在每个location块中使用fastcgi_pass指令来传递请求。具体配置如下:
```
http {
# 设置fastcgi参数
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
# 在每个location块中使用fastcgi_pass指令来传递请求
server {
listen 80;
server_name example.com;
location / {
fastcgi_pass 127.0.0.1:9000;
}
location /blog {
fastcgi_pass 127.0.0.1:9000;
}
location /forum {
fastcgi_pass 127.0.0.1:9000;
}
}
}
```
这样配置后,所有的location块都会使用fastcgi标准。