Nginx 配置錯誤,Google了一遍又一遍,就是沒有相似的錯誤和解決辦法...這個錯誤真是奇葩了啊,大牛幫忙看看是怎麼回事?

來源:互聯網
上載者:User
nginx設定檔如下:

worker_processes  1;worker_rlimit_nofile  65535;#error_log  logs/error.log;#error_log  logs/error.log  notice;#error_log  logs/error.log  info;error_log  logs/error.log  crit; pid  logs/nginx.pid;events {  worker_connections  65535;  multi_accept  on;  use  epoll;}http {  include  mime.types;  default_type  application/octet-stream;  #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '  #                  '$status $body_bytes_sent "$http_referer" '  #                  '"$http_user_agent" "$http_x_forwarded_for"';  #access_log  logs/access.log  main;  access_log  off;  server_tokens  off;  sendfile  on;  tcp_nopush  on;  tcp_nodelay  on;  #keepalive_timeout  0;  keepalive_timeout  10;  client_header_timeout  10;   client_body_timeout  10;   reset_timedout_connection  on;   send_timeout  10;   gzip  on;  gzip_min_length  1024;  gzip_buffers  4 16k;  #gzip_http_version  1.1;  gzip_comp_level  2;  fastcgi_cache_path  /usr/local/nginx/fastcgi_cache levels=1:2 keys_zone=TEST:10m inactive=5m;  fastcgi_connect_timeout  300;  fastcgi_send_timeout  300;  fastcgi_read_timeout  300;  fastcgi_buffer_size  64k;  fastcgi_buffers  4 64k;  fastcgi_busy_buffers_size  128k;  fastcgi_temp_file_write_size  128k;  fastcgi_cache  TEST;  fastcgi_cache_valid  200 302 1h;  fastcgi_cache_valid  301 1d;  fastcgi_cache_valid  any 1m;  server_names_hash_bucket_size  128;  client_header_buffer_size  32k;  large_client_header_buffers  4 32k;  client_max_body_size  8m;  server {    listen  80 default;    server_name  _;    return  403;  }  include /usr/local/nginx/conf/vhosts/*.conf;

測試Nginx 得到如下錯誤資訊:

[root@test conf]# /usr/local/nginx/sbin/nginx -tnginx: [emerg] unknown directive "fastcgi_cache_path" in /usr/local/nginx/conf/nginx.conf:46nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed

回複內容:

nginx設定檔如下:

worker_processes  1;worker_rlimit_nofile  65535;#error_log  logs/error.log;#error_log  logs/error.log  notice;#error_log  logs/error.log  info;error_log  logs/error.log  crit; pid  logs/nginx.pid;events {  worker_connections  65535;  multi_accept  on;  use  epoll;}http {  include  mime.types;  default_type  application/octet-stream;  #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '  #                  '$status $body_bytes_sent "$http_referer" '  #                  '"$http_user_agent" "$http_x_forwarded_for"';  #access_log  logs/access.log  main;  access_log  off;  server_tokens  off;  sendfile  on;  tcp_nopush  on;  tcp_nodelay  on;  #keepalive_timeout  0;  keepalive_timeout  10;  client_header_timeout  10;   client_body_timeout  10;   reset_timedout_connection  on;   send_timeout  10;   gzip  on;  gzip_min_length  1024;  gzip_buffers  4 16k;  #gzip_http_version  1.1;  gzip_comp_level  2;  fastcgi_cache_path  /usr/local/nginx/fastcgi_cache levels=1:2 keys_zone=TEST:10m inactive=5m;  fastcgi_connect_timeout  300;  fastcgi_send_timeout  300;  fastcgi_read_timeout  300;  fastcgi_buffer_size  64k;  fastcgi_buffers  4 64k;  fastcgi_busy_buffers_size  128k;  fastcgi_temp_file_write_size  128k;  fastcgi_cache  TEST;  fastcgi_cache_valid  200 302 1h;  fastcgi_cache_valid  301 1d;  fastcgi_cache_valid  any 1m;  server_names_hash_bucket_size  128;  client_header_buffer_size  32k;  large_client_header_buffers  4 32k;  client_max_body_size  8m;  server {    listen  80 default;    server_name  _;    return  403;  }  include /usr/local/nginx/conf/vhosts/*.conf;

測試Nginx 得到如下錯誤資訊:

[root@test conf]# /usr/local/nginx/sbin/nginx -tnginx: [emerg] unknown directive "fastcgi_cache_path" in /usr/local/nginx/conf/nginx.conf:46nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed

你是怎麼安裝的nginx啊 configure怎麼設定的 總感覺你的http_fastcgi_module模組沒有安裝
你nginx -V 看下輸出 是不是把他給without了啊

更新:
經題主測試 開啟--with-http-cache後,fastcgi_cache可用

補充一下,Nginx版本是1.6.3,最新穩定版

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.