Nginx
Service overview
| Software owner | NGINX Inc |
|---|---|
| System requirements | |
| Management | wfmanager (start | stop | restart | status) nginx |
| Log files | Access logs: <INSTALL_DIR>/supervisord/log/nginx.out.log |
| Startup scripts | <INSTALL_DIR>/supervisord/apps/nginx.ini <INSTALL_DIR>/nginx/run_nginx.sh |
| Configuration files | Service directory: <INSTALL_DIR>/nginx/ |
| Default Ports | tcp 8080, 8443 |
Default parameters
| Configuration file | Name | Default Value | Description |
|---|---|---|---|
| config.yml | install_dir |
/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/ directory |
Troubleshooting
Check configuration for syntax errors or warnings.
<INSTALL_DIR>/nginx/bin/nginx -p <INSTALL_DIR>/nginx -c nginx.conf -t
The successful result is:
$ 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 successful
Check 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: master
ss 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 number of running Nginx processes. This should not be less than 1.
pgrep command output
pgrep nginx | wc -l
Check 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
Check nginx out (access) log using the Wfmanager util.
wfmanager tail nginx
Check 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.html
Enable the debug information.
Set the appropriate log level to <INSTALL_DIR>/nginx/nginx.conf (default is info) and restart the Nginx service:
${install_dir}/nginx/nginx.conf
error_log stderr debug;
wfmanager restart nginx
Check if DNS configured properly.
On most systems, /etc/hosts has priority over 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.110
Getent output should be IPv4:
getent command output
$ getent hosts app.example.com
172.31.38.110 app.example.com
Full DNS record resolution:
$ dig -t A +trace app.example.com