Nginx
Service overview
| Software owner | NGINX Inc |
|---|---|
| System requirements | |
| Management | wfmanager (start | stop | restart | status) nginx |
| Log files | Access logs: |
| Startup scripts | <INSTALL_DIR>/supervisord/apps/nginx.ini<INSTALL_DIR>/nginx/run_nginx.sh |
| Configuration files | Service directory: |
| Default ports | TCP 8080, 8443 |
Default parameters
| Configuration file | Name | Default value | Description |
|---|---|---|---|
config.yml |
|
/opt/workfusion |
Directory to put user files, logs, and configs |
config.yml |
nginx_{role}_port |
8080 | Default service port for NON-SSL installation |
config.yml |
nginx_{role}_port_ssl |
8443 | Default service port for SSL installation |
secrets.yml |
NGINX CERTIFICATES |
Certificates name from certificates or directory |
Troubleshooting
Check the configuration for syntax errors or warnings:
<INSTALL_DIR>/nginx/bin/nginx -p <INSTALL_DIR>/nginx -c nginx.conf -tThe successful result is as follows:
$ nginx/bin/nginx -p nginx -c nginx.conf -t nginx: the configuration file nginx/nginx.conf syntax is ok nginx: configuration file nginx/nginx.conf test is successfulCheck if TCP ports 8080 and 8443 are available.
Ports may be custom:
netstat command output
$ netstat -lntp | grep nginx tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 21145/nginx: master tcp 0 0 0.0.0.0:8443 0.0.0.0:* LISTEN 21145/nginx: masterss command output
$ ss -ltn | egrep '8080|8443' LISTEN 0 511 *:8080 *:* LISTEN 0 511 *:8443 *:*lsof command output
$ lsof -P -n -i :8080 -i :8443 | grep LISTEN nginx 21145 wfuser 4u IPv4 568975 0t0 TCP *:8080 (LISTEN) nginx 21145 wfuser 6u IPv4 568977 0t0 TCP *:8443 (LISTEN) nginx 21147 wfuser 4u IPv4 568975 0t0 TCP *:8080 (LISTEN) nginx 21147 wfuser 6u IPv4 568977 0t0 TCP *:8443 (LISTEN) nginx 21148 wfuser 4u IPv4 568975 0t0 TCP *:8080 (LISTEN) nginx 21148 wfuser 6u IPv4 568977 0t0 TCP *:8443 (LISTEN)Count the number of running Nginx processes. This should not be less than 1.
pgrep command output
pgrep nginx | wc -lCheck the default main log files:
- Access logs:
<INSTALL_DIR>/supervisord/log/nginx.out.log - Error logs:
<INSTALL_DIR>/supervisord/log/nginx.err.log
$ tail -f <INSTALL_DIR>/supervisord/log/nginx.err.log <INSTALL_DIR>/supervisord/log/nginx.out.log- Access logs:
Check the Nginx out (access) log using the wfmanager util:
wfmanager tail nginxCheck the permissions and full path access to the files accessed by Nginx.
$ namei -om /opt/workfusion/nginx/var/www/tinymce/js/tinymce/themes/inlite/src/demo/html/demo.html f: /opt/workfusion/nginx/var/www/tinymce/js/tinymce/themes/inlite/src/demo/html/demo.html dr-xr-xr-x root root / drwxr-xr-x root root opt drwxr-x--- wfuser wfuser workfusion drwxr-xr-x wfuser wfuser nginx drwxrwxr-x wfuser wfuser var drwxrwx--- wfuser wfuser www drwxrwxr-x wfuser wfuser tinymce drwxrwxr-x wfuser wfuser js drwxrwxr-x wfuser wfuser tinymce drwxrwxr-x wfuser wfuser themes drwxrwxr-x wfuser wfuser inlite drwxrwxr-x wfuser wfuser src drwxrwxr-x wfuser wfuser demo drwxrwxr-x wfuser wfuser html -rwxrwxr-x wfuser wfuser demo.htmlEnable debug information.
Set the appropriate log level to
<INSTALL_DIR>/nginx/nginx.conf(default isinfo) and restart the Nginx service:${install_dir}/nginx/nginx.conferror_log stderr debug;wfmanager restart nginxCheck if DNS is configured properly.
On most systems,
/etc/hostshas the priority over the DNS resolution. So first, check the contents of that file. In any case, DNS records should be in place, and you can verify them with:$ host -t A app.example.com app.example.com has address 172.31.38.110The
getentoutput should be IPv4:$ getent hosts app.example.com 172.31.38.110 app.example.comFull DNS record resolution:
$ dig -t A +trace app.example.com