首页 > 解决方案 > unknown directive "state" in nginx 1.17.7

问题描述

I am trying to read the office doc of nginx.

There is the following in the upstream module.

Syntax: state file;
Default:    —
Context:    upstream
This directive appeared in version 1.9.7.

I tried to change the nginx.conf as following.

upstream loserver {
      #server localhost:9002 max_fails=1 fail_timeout=1000s weight=2;
      #server localhost:9001 max_fails=1 fail_timeout=1000s weight=100;
      state /usr/local/nginx-1.17.1/conf/state_zwshao.conf;
    }

And run the command to nginx -t to test the configuration.

I got the following errors

unknown directive "state".

Anyone know the reason?

标签: nginx

解决方案


推荐阅读