---
title: Nginx Configuration
slug: routing/nginx-configuration
description: Nginx Configuration
createdAt: 2026-04-03T05:57:32.713Z
---

## <font color="#1d50a2">Nginx Configuration</font>

### <font color="#1d50a2">show nginx status</font>

**\[Command]**

**show nginx status**

**\[Purpose]**

Display the enabled status of Nginx and the number of cores utilized by Nginx, where Master\_count is always 1, indicating the number of master processes of Nginx; Worker\_count represents the number of cores corresponding to the Nginx service, defaulting to 2 and adjustable via the command line using the cpu\_core nginx\_num command.

**\[View]**

System view

**\[Use Cases]**

```plaintext
sonic# show nginx status
  Status: OK
    Master_count: 1
    Worker_count: 2
```

### <font color="#1d50a2">show nginx config</font>

**\[Command]**

**show nginx config**

**\[Purpose]**

Display the global parameter configuration results of nginx and the loading status of configuration files, such as cert files and server files.

**\[View]**

System view

**\[Use Cases]**

```plaintext
sonic# show nginx config
  worker_processes: 3
  worker_connections: 1500
  keepalive_timeout: 80

  server nginx_1:
    listen: 17.1.1.2:188 ssl
    ssl_certificate: /etc/sonic/nginx/cert/asterfusion.crt
    Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            fe:35:86:b8:2a:f2:79:8a
        Signature Algorithm: ecdsa-with-SHA256
        Issuer: C = CN, ST = SUZHOU, O = Internet Widgits Pty Ltd, CN = SO\08\1B[CPHIE
        Validity
            Not Before: Mar 17 08:07:41 2026 GMT
            Not After : Mar 17 08:07:41 2027 GMT
        Subject: C = CN, ST = HARBIN, O = Internet Widgits Pty Ltd, CN = LC
        Subject Public Key Info:
            Public Key Algorithm: id-ecPublicKey
                Public-Key: (256 bit)
                pub:
                    04:41:c5:64:9f:a1:13:76:6e:ea:9f:ac:a7:6d:c5:
                    3b:9f:d5:7d:e0:7e:d2:9f:27:b1:03:73:89:6f:22:
                    1a:44:e9:0a:6f:27:73:99:80:f8:eb:80:5e:35:94:
                    90:92:cc:0f:70:3f:2f:40:59:57:8c:81:15:f9:25:
                    75:14:a4:46:ed
                ASN1 OID: prime256v1
                NIST CURVE: P-256
        X509v3 extensions:
            X509v3 Basic Constraints:
                CA:FALSE
            X509v3 Key Usage:
                Digital Signature, Non Repudiation, Key Encipherment
    Signature Algorithm: ecdsa-with-SHA256
    Signature Value:
        30:45:02:21:00:a4:ed:6b:20:c2:97:09:5a:83:34:7d:1d:e0:
        f2:0c:ca:ae:12:27:d8:6b:91:3b:b7:18:da:e8:08:17:1c:8e:
        7d:02:20:55:52:19:d5:e7:f0:30:ca:5e:b7:76:76:ff:52:9c:
        9e:42:44:aa:51:98:9a:fe:a2:36:57:b3:bd:f3:c8:01:91


  server nginx_2:
    listen: 199 ssl
```

### <font color="#1d50a2">cpu\_core \{nginx\_num *string1* | vpp\_num *string2*\}</font>

**\[Command]**

**cpu\_core \{nginx\_num *string1&#x20;*| vpp\_num *string2*}**

**no** **cpu\_core**

**\[Purpose]**

Configure the number of cores for both VPP and nginx. When not configured, the default number of cores for VPP is 6 and for nginx is 1. For the ET2500 model device, there are a total of 8 cores. VPP defaults to using the last 6 cores (corresponding to core numbers 2-7), while nginx defaults to using the first core (for core number 0). The recommended number of cores to configure is set to 3 for vpp\_num and 3 for nginx.

**\[View]**

System configuration view

**\[Notes]**

Note that when the device model is ET2500, nginx\_num+vpp\_num≤8， Attention should be paid during configuration; And after configuring the nginx core number, nginx reload needs to be executed to take effect, while vpp core number needs to be configured and the device writes and saves the configuration before reloading can take effect.When executing no cpu\_core, both parameters will return to their default values.

**\[Use Cases]**

```plaintext
sonic(config)# cpu_core vpp_num 3 nginx_num 3
```

### <font color="#1d50a2">nginx start</font>

**\[Command]**

**nginx start**

**\[Purpose]**

Enable nginx service, default to off state; After enabling, the enable status can be viewed by showing nginx status.

**\[View]**

System configuration view

**\[Use Cases]**

```plaintext
sonic(config)# nginx start
```

### <font color="#1d50a2">nginx stop</font>

**\[Command]**

**nginx stop**

**\[Purpose]**

Disable nginx service.

**\[View]**

System configuration view

**\[Use Cases]**

```plaintext
sonic(config)# nginx stop
```

### <font color="#1d50a2">nginx reload</font>

**\[Command]**

**nginx reload**

**\[Purpose]**

Reloading configuration is used for situations where nginx uploads new configuration files, global parameters, core configurations, or deletes related configuration files through updates. In other words, when nginx's configuration changes, it is necessary to perform nginx reload to make the configuration loading effective.

**\[View]**

System configuration view

**\[Use Cases]**

```plaintext
sonic(config)# nginx reload
```

### <font color="#1d50a2">nginx keepalive\_timeout *time*</font>

**\[Command]**

**nginx keepalive\_timeout *time***

**\[Purpose]**

Configure nginx to maintain a timeout for TCP connections. Specify the number of seconds Nginx should keep the connection open and wait for subsequent requests after completing a request with the client. After timeout, the connection will be closed to save resources. After configuration, execute nginx reload to successfully load it.

**\[Parameter]**

| **Parameter** | **Description**                                       |
| ------------- | ----------------------------------------------------- |
| time          | Timeout parameter, configurable range from 0 to 65535 |

**\[View]**

System configuration view

**\[Use Cases]**

```plaintext
sonic(config)# nginx keepalive_timeout 80
```

### <font color="#1d50a2">nginx worker\_connections *num*</font>

**\[Command]**

**nginx worker\_connections *num***

**\[Purpose]**

Configure the maximum number of connections that each Nginx worker process can open simultaneously; This value affects the concurrent processing capability of the server, and the total concurrent limit needs to be calculated in conjunction with workr\_processes. After configuration, execute nginx reload to successfully load it.

**\[Parameter]**

| **Parameter** | **Description**                                                                                        |
| ------------- | ------------------------------------------------------------------------------------------------------ |
| num           | The maximum number of connections for nginx processes can be configured within the range of 1 to 65535 |

**\[View]**

System configuration view

**\[Use Cases]**

```plaintext
sonic(config)# nginx worker_connections 1500
```

### <font color="#1d50a2">nginx update \{cert|server\} *string*</font>

**\[Command]**

**nginx update \{cert|server} *string***

**\[Purpose]**

Configure the server configuration file path/authentication key file path for nginx. Note that the string needs to be specified as the full path. After configuration, execute nginx reload to successfully load it. The loading result can be viewed through show nginx config.

**\[Parameter]**

| **Parameter** | **Description**                                                                        |
| ------------- | -------------------------------------------------------------------------------------- |
| string        | Configure the path of the Cert file/server configuration file that needs to be loaded. |

**\[View]**

System configuration view

**\[Use Cases]**

```plaintext
sonic(config)# nginx update cert /home/admin/asterfusion.crt
sonic(config)# nginx update cert /home/admin/asterfusion.key
sonic(config)# nginx update server /home/admin/nginx_test1.conf
```

