fastcgi配置
fastcgi配置
我們這裡說的fastcgi配置專指nginx對fastcgi的配置,fastcgi本身的配置介紹在fastcgi 安裝文中有說明。
nginx的fastcgi模組提供的命令
fastcgi_pass
這個命令是指定將http代理到哪個fastcgi服務端介面。fastcgi_pass後面是填寫fastcgi服務端地址的,這個地址可以是域地址,也可以是Uninx-域套接字。
fastcgi_pass localhost:9000;
fastcgi_pass unix:/tmp/fastcgi.socket;
這裡的設定需要和fastcgi自身配置的listen_address做相應地對應。
比如上面那個例子,listen_addree就應該這麼配置:
<value name="listen_address">/tmp/fastcgi.socket</value>
fastcgi_param
這個命令是設定fastcgi請求中的引數,具體設定的東西可以在$_SERVER中獲取到。
比如你想要設定當前的機器環境,可以使用fastcgi_param ENV test;
來設定。
對於php來說,最少需要設定的變數有:
fastcgi_param SCRIPT_FILENAME /home/www/scripts/php$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
對於POST請求,還需要設定:
fastcgi_param REQUEST_METHOD requestmethod;fastcgiparamCONTENTTYPEcontent_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param還可以使用if_not_empty進行設定。意思是如果value非空才進行設定。
fastcgi_param HTTPS $https if_not_empty;
fastcgi_index
這個命令設定了fastcgi預設使用的指令碼。就是當SCRIPT_FILENAME沒有命中指令碼的時候,使用的就是fastcgi_index設定的指令碼。
以上三個命令能組成最基本的fastcgi設定了
location / {
fastcgi_pass localhost:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/www/scripts/php$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;
}
fastcgi_hide_header,fastcgi_ignore_headers,fastcgi_pass_header
fastcgi_cache
這個命令是開啟fastcgi的檔案快取。這個快取可以將動態的頁面存為靜態的。以提供為加速或者容災使用。
本文轉自軒脈刃部落格園部落格,原文連結:http://www.cnblogs.com/yjf512/p/4799850.html,如需轉載請自行聯絡原作者
相關文章
- Nginx配置fastcgi cacheNginxAST
- Nginx 配置 fastcgi cacheNginxAST
- FastCGI 程式管理器(FPM)-配置AST
- Ubuntu下的apache2 + fastcgi配置UbuntuApacheAST
- Linux上配置Nginx+PHP5(FastCGI)LinuxNginxPHPAST
- Apache+Fastcgi模組+APC經典配置薦ApacheAST
- CGI與FastCGIAST
- FastCGI規範AST
- 實戰Nginx與PHP(FastCGI)的安裝、配置與最佳化NginxPHPAST
- CentOSYUM安裝Apache2後如何安裝配置mod_fastcgiCentOSApacheAST
- FastCGI協議分析AST協議
- nginx結合fastcgiNginxAST
- fastCGI研究記錄AST
- PHP FastCGI RCE VulPHPAST
- cgi,fastcgi,php-fpmASTPHP
- apache-實戰FastCGIApacheAST
- PHP fastcgi_finish_request 方法PHPAST
- 寫了一個 FastCGI 實現AST
- CGI / FASTCGI已停止工作 彩蛋?AST
- fastcgi協議分析與例項AST協議
- 淺談PHP fastcgi和php-fpmPHPAST
- Nginx、fastCGI、php-fpm關係梳理NginxASTPHP
- Nginx的ngx_http_fastcgi_module模組NginxHTTPAST
- LNMP+FastCGI平臺搭建指令碼LNMPAST指令碼
- 解釋nginx.conf.default 中關於fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;NginxAST
- CGI,FastCGI,PHP-FPM,PHP-CLI,modPHPASTPHP
- 檢視nginx傳輸FASTCGI格式資料NginxAST
- FastCGI sent in stderr: "Primary script unknown" 報錯AST
- PHP之FastCGI與mod_php詳解PHPAST
- IIS下PHP的ISAPI和FastCGI比較PHPAPIAST
- 方案一、Nginx+mono+ fastcgi-mono-serverNginxMonoASTServer
- Windows下IIS以FastCGI模式執行PHPWindowsAST模式PHP
- Windows下Apache以FastCGI模式執行PHPWindowsApacheAST模式PHP
- PHP 之 FastCGI 與 mod_php 詳解PHPAST
- 一文搞懂 CGI, FastCGI, WSGI, uWSGI, uwsgiAST
- 白話 CGI,FastCGI,PHP-CGI,PHP-fpmASTPHP
- 區分wsgi、uWSGI、uwsgi、php-fpm、CGI、FastCGIPHPAST
- using-fastcgi-to-host-php-applications-on-iis7ASTPHPAPP