Command Line Reference
Nginx Configuration
14 min
nginx configuration nginx configuration show nginx status show nginx status \[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] sonic# show nginx status status ok master count 1 worker count 2 show nginx config show nginx config \[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] 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 cpu core {nginx num cpu core {nginx num string1 | vpp num string2 } \[command] cpu core {nginx num string1 | 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] sonic(config)# cpu core vpp num 3 nginx num 3 nginx start nginx start \[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] sonic(config)# nginx start nginx stop nginx stop \[command] nginx stop \[purpose] disable nginx service \[view] system configuration view \[use cases] sonic(config)# nginx stop nginx reload nginx reload \[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] sonic(config)# nginx reload nginx keepalive timeout nginx keepalive timeout time \[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] sonic(config)# nginx keepalive timeout 80 nginx worker connections nginx worker connections num \[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] sonic(config)# nginx worker connections 1500 nginx update {cert|server} nginx update {cert|server} string \[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] 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
