1

I am using the following configuration

upstream site {
    server 127.0.0.1:3000;
    keepalive 64;
}

server {
    listen 80;

    error_page 400 404 500 502 503 504 /50x.html;
    location  /50x.html {
            internal;
            root /usr/share/nginx/www;
    }

    location /static {
        root /opt/site/static;
        access_log off;
        expires max;
    }

    location / {
        proxy_redirect off;
        proxy_set_header   X-Real-IP            $remote_addr;
        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_set_header   Host                   $http_host;
        proxy_set_header   X-NginX-Proxy    true;
        proxy_set_header   Connection "";
        proxy_http_version 1.1;
        proxy_pass         http://site;
        proxy_intercept_errors on;
    }
}

I have saved it to /etc/nginx/sites-available/site.conf and symlinked to it /etc/sites-enabled/site.conf , and when I restart nginx it gives me the following error:

Restarting nginx: [emerg]: unknown directive "keepalive" in /etc/nginx/sites-enabled/site.conf:3

4

2 回答 2

2

没有keepalive指令。改为使用keepalive_timeout。而且你不能把它放在里面upsream,使用里面httpserver或者location

于 2013-04-30T16:52:05.563 回答
0

选项“keepalive”由keepalive 模块提供。从 1.1.4 开始,keepalive 功能包含在主代码中。

于 2013-10-14T15:11:52.167 回答