apisix/doc/customize-nginx-configuration.md
2020-11-25 19:23:31 +08:00

2.1 KiB

中文

Customize Nginx configuration

The Nginx configuration used by APISIX is generated via the template file apisix/ngx_tpl.lua and the options from conf/config-default.yaml / conf/config.yaml.

You can take a look at the generated Nginx configuration in conf/nginx.conf after running ./bin/apisix start.

If you want to customize the Nginx configuration, please read through the nginx_config in conf/config-default.yaml. You can override the default value in the conf/config.yaml. For instance, you can inject some snippets in the conf/nginx.conf via configuring the xxx_snippet entries:

...
# put this in config.yaml:
nginx_config:
    main_configuration_snippet: |
        daemon on;        
    http_configuration_snippet: |
        server
        {
            listen 45651;
            server_name _;
            access_log off;

            location /ysec_status {
                req_status_show;
                allow 127.0.0.1;
                deny all;
            }
        }

        chunked_transfer_encoding on;        

    http_server_configuration_snippet: |
        set $my "var";        
    http_admin_configuration_snippet: |
        log_format admin "$request_time $pipe";        
    stream_configuration_snippet: |
        tcp_nodelay off;        
...