FAQ

Page Discussion Edit History

ChsHttpFcgiModule

(Redirected from NginxChsHttpFcgiModule)


Contents

[edit] 鎽 瑕

杩欎釜妯″潡鍏佽Nginx 涓嶧astCGI 杩涚▼浜や簰锛屽苟閫氳繃浼犻掑弬鏁版潵鎺у埗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;
}

璇硶锛

[edit] fastcgi_buffers

syntax: fastcgi_buffers the_number is_size;

default: fastcgi_buffers 8 4k/8k;

context: http, server, location

璇ユ寚浠ら泦璁剧疆缂撳啿鍖虹殑鏁伴噺鍜屽ぇ灏忥紝鐢ㄤ簬缂撳瓨浠 FastCGI Server 鎺ユ敹鍒扮殑鏁版嵁銆傞粯璁ゆ儏鍐典笅锛屼竴涓紦鍐插尯鐨勫ぇ灏忕浉褰撲簬涓涓〉闈㈢殑澶у皬銆傛牴鎹钩鍙扮殑涓嶅悓璁剧疆涓4K/8K

[edit] fastcgi_buffer_size

璇硶: fastcgi_buffer_size 澶у皬

榛樿: fastcgi_buffer_size 4k/8k

鐜: http, server, location

璇ュ懡浠よ缃紦鍐插尯澶у皬锛屽叾涓皢璇诲彇绗竴閮ㄥ垎鐨勮緭鍑猴紝浠巉astcgi鏈嶅姟绔幏鍙

鍦ㄨ繖涓緭鍑虹殑灏忚緭鍑烘爣澶撮儴鍒嗙殑浣嶇疆锛屼綔涓轰竴椤硅鍒

榛樿鎯呭喌涓嬶紝缂撳啿鍖哄ぇ灏忔槸绛変簬涓涓猣astcgi缂撳啿鍖哄ぇ灏忥紝鍏佽灏嗗叾璁剧疆涓烘洿灏

[edit] fastcgi_cache

syntax: fastcgi_cache zone;

default: none

context: http, server, location

璁剧疆缂撳瓨鍦ㄥ叡浜唴瀛樹腑鐨勫悕绉. 涓鍧楀尯鍩熷彲浠ヨ鐢ㄤ簬涓嶇敤鐨勫湴鏂.

[edit] fastcgi_cache_key

syntax: fastcgi_cache_key line ;

default: none

context: http, server, location

璁剧疆缂撳瓨鐨刱ey, 渚:

fastcgi_cache_key localhost: 9000 $ request_uri;

[edit] fastcgi_cache_methods

璇硶: fastcgi_cache_methods [GET HEAD POST];

榛樿: fastcgi_cache_methods GET HEAD;

鐜: main,http,location

GET/HEAD 璇硶绯, 涔熷氨鏄. 鍗充娇浣犲垰鍒氳缃紝涔熸棤娉曠鐢 GET/HEAD

fastcgi_cache_methods  POST;

[edit] fastcgi_cache_min_uses

syntax: fastcgi_cache_min_uses n

default: fastcgi_cache_min_uses 1

context: http, server, location

TODO: Description.

[edit] fastcgi_cache_path

syntax: fastcgi_cache_path /path/to/cache [levels=m:n keys_zone=name:time inactive=time clean_time=time]

default: none

context: http, server, location

TODO: Description.

[edit] fastcgi_cache_use_stale

syntax: fastcgi_cache_use_stale [updating|error|timeout|invalid_header|http_500]

default: fastcgi_cache_use_stale off;

context: http, server, location

TODO: Description.

[edit] fastcgi_cache_valid

syntax: fastcgi_cache_valid [http_error_code|time]

default: none

context: http, server, location

TODO: Description. 

[edit] fastcgi_index

syntax: fastcgi_index file

default: none

context: http, server, location

The name of the file which will be appended to the URI and stored in the variable $fastcgi_script_name if URI concludes with a slash.

[edit] fastcgi_hide_header

syntax: fastcgi_hide_header name

context: http, server, location

榛樿鎯呭喌涓婲ginx 涓嶄細浠嶧astCGI 杩涚▼閲岀粰瀹㈡埛绔彂閫"Status" 鍜"X-Accel-..." 娑堟伅澶淬傝繖涓寚浠ゅ彲浠ョ敤鏉ユ帺楗板埆鐨刪eaders 銆

濡傛灉闇瑕"Status" 鍜"X-Accel-..." 娑堟伅澶达紝閭e氨闇瑕佷娇鐢ㄨ繖涓寚浠よFastCGI 寮哄埗鍙戦佹秷鎭ご缁欏鎴风銆

[edit] fastcgi_ignore_client_abort

syntax: fastcgi_ignore_client_abort on|off

default: fastcgi_ignore_client_abort off

context: http, server, location

杩欎釜鎸囦护鐢ㄦ潵鍐冲畾蹇界暐鐢ㄦ埛鍙栨秷鐨勮姹傘

[edit] fastcgi_intercept_errors

syntax: fastcgi_intercept_errors on|off

default: fastcgi_intercept_errors off

context: http, server, location

杩欎釜鎸囦护鐢ㄦ潵鍐冲畾鏄惁瑕佹妸瀹㈡埛绔浆鍚4xx鍜5xx閿欒椤碉紝鎴栧厑璁窷ginx鑷姩鎸囧畾閿欒椤甸〉銆

娉ㄦ剰锛氫綘闇瑕佸湪姝ゆ槑纭敊璇〉,瀹冩墠鏄湁鐢ㄧ殑銆侷gor 鏇捐锛氣滃鏋滄病鏈夊畾鍒剁殑澶勭悊鏈哄埗锛孨ginx涓嶄細鎷︽埅涓涓病鏈夌己鐪侀〉鐨勯敊璇侼ginx 鍙細鎷︽埅涓浜涘皬鐨勯敊璇紝鏀捐繃鍏朵粬涓浜涖

[edit] fastcgi_param

syntax: fastcgi_param parameter value

default: none

context: http, server, location

璇ユ寚浠ゆ寚瀹氱殑鍙傛暟,灏嗚浼犻掔粰FastCGI-server銆

瀹冨彲鑳戒娇鐢ㄥ瓧绗︿覆銆佸彉閲忓強鍏跺畠浠殑缁勫悎鏉ヤ綔涓哄弬鏁板笺傚鏋滀笉鍦ㄦ鍒跺畾鍙傛暟锛屽畠灏变細缁ф壙澶栧眰璁剧疆锛涘鏋滃湪姝よ缃簡鍙傛暟锛屽皢娓呴櫎澶栧眰鐩稿叧璁剧疆锛屼粎鍚敤鏈眰璁剧疆銆

涓嬮潰鏄竴涓緥瀛,瀵逛簬PHP鏉ヨ鐨勬渶绮剧畝鐨勫繀瑕佸弬鏁帮細

  fastcgi_param  SCRIPT_FILENAME  /home/www/scripts/php$fastcgi_script_name;
  fastcgi_param  QUERY_STRING     $query_string;

鍙傛暟SCRIPT_FILENAME 鏄疨HP 鐢ㄦ潵纭畾鎵ц鑴氭湰鐨勫悕瀛楋紝鑰屽弬鏁癚UERY_STRING 鏄畠鐨勪竴涓瓙鍙傛暟銆

濡傛灉瑕佸鐞哖OST,閭d箞杩欎笁涓檮鍔犲弬鏁版槸蹇呰鐨勶細

  fastcgi_param  REQUEST_METHOD   $request_method;
  fastcgi_param  CONTENT_TYPE     $content_type;
  fastcgi_param  CONTENT_LENGTH   $content_length;

濡傛灉PHP 鍦ㄧ紪璇戞椂浣跨敤浜--enable-force-cgi-redirect閫夐」锛岃缃弬鏁癛EDIRECT_STATUS 鐨勫间负200灏辨槸蹇呴』鐨勪簡銆

  fastcgi_param  REDIRECT_STATUS  200;