Memo for Nginx Configuration

By | 2019 年 2 月 6 日

Nginx is a widely used web service, another comparable is Apache.

Nginx Status

Can be checked by ps:

# ps aux|grep nginx
root      1226  0.0  0.0 126844  1632 ?        Ss   Feb03   0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data  1227  0.0  0.0 127192  7476 ?        S    Feb03   0:18 nginx: worker process
www-data  1228  0.0  0.0 127736  7996 ?        S    Feb03   0:17 nginx: worker process
www-data  1229  0.0  0.0 127012  7496 ?        S    Feb03   0:17 nginx: worker process
www-data  1230  0.0  0.0 127308  7752 ?        S    Feb03   0:17 nginx: worker process
root      3714  0.0  0.0  14224  1088 pts/0    S+   07:36   0:00 grep --color=auto nginx

The current running nginx configurations can be checked by nginx -V:

# nginx -V
nginx version: nginx/1.10.3 (Ubuntu)
built with OpenSSL 1.0.2g  1 Mar 2016
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads

Nginx Configurations

Nginx configurations are distributing across host, but with this command, we can get all of them:

# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

One thing to mention is that, some of the site configs may be included in the nginx.conf with include command, e.g. (in the nginx.conf):

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
include SOME_OTHER_SITE_CONFs;

发表评论

电子邮件地址不会被公开。 必填项已用*标注