Opened 5 years ago

Closed 5 years ago

#763 closed defect (invalid)

service nginx configtest always returns zero exit code

Reported by: dandv.livejournal.com Owned by:
Priority: major Milestone:
Component: nginx-core Version: 1.7.x
Keywords: Cc:
uname -a: Linux localhost 4.0.2-x86_64-linode56 #1 SMP Mon May 11 16:55:19 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.8.0

Description

This issue affects many users who mistakenly assume that configtest returns a useful error code.

# nginx -t && echo $?
nginx: [emerg] invalid parameter "server_name" in /etc/nginx/sites-enabled/piwik:5
nginx: configuration file /etc/nginx/nginx.conf test failed
# service nginx configtest && echo $?
 * Testing nginx configuration                              [fail]
0
# /etc/init.d/nginx configtest && echo $?
 * Testing nginx configuration                              [fail]
0

The version is 1.8.0 but I can't select that in the dropdown here on trac.

Change History (1)

comment:1 by Maxim Dounin, 5 years ago

Resolution: invalid
Status: newclosed

The "nginx -t" command returns useful error code, and init scripts as shipped in official packages do the same. The problem you are seeing is probably in the init script you are using, not in nginx.

Note: See TracTickets for help on using tickets.