Opened 6 years ago

Closed 6 years ago

#1758 closed defect (duplicate)

CLI test configuration does not detect error within index directive

Reported by: ronaronica@… Owned by:
Priority: minor Milestone:
Component: nginx-package Version: 1.14.x
Keywords: Cc:
uname -a: Linux raspberrypi 4.14.98+ #1200 Tue Feb 12 20:11:02 GMT 2019 armv6l GNU/Linux
nginx -V: nginx version: nginx/1.14.2
built with OpenSSL 1.1.1a 20 Nov 2018 (running with OpenSSL 1.1.0j 20 Nov 2018)
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-cXZqnI/nginx-1.14.2=. -fstack-protector-strong -Wformat -Werror=format-security -fP
IC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -fPIC' --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 --modules-path=/usr/lib/nginx/m
odules --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-scg
i-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module
--with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_ad
dition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_su
b_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-mail=dynamic --with-mail_ssl_m
odule --add-dynamic-module=/build/nginx-cXZqnI/nginx-1.14.2/debian/modules/http-auth-pam --add-dynamic-module=/build/nginx-cXZqnI/nginx-1.14.2/debian/modules/
http-dav-ext --add-dynamic-module=/build/nginx-cXZqnI/nginx-1.14.2/debian/modules/http-echo --add-dynamic-module=/build/nginx-cXZqnI/nginx-1.14.2/debian/modul
es/http-upstream-fair --add-dynamic-module=/build/nginx-cXZqnI/nginx-1.14.2/debian/modules/http-subs-filter

Description

Test configuration does not detect a missing semicolon at the end of the index directive with the html context. As a result the following directive fails. The below code is correct and works properly. Remove the index semicolon and nginx -t still reports no errors, but error.log reports " no ssl_certificate is defined." This particular error results because ssl_certificate is the next directive after the index directive. Different errors will appear in different configurations.

##
# These are site-specific entries for nginx html context.
# There are other conf files in /etc/nginx/sites-available for specific
# server contexts.
##

add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options SAMEORIGIN;
add_header X-XSS-Protection "1; mode=block";
index index.php index.htm index.html;
##
# SSL Settings
##

ssl_certificate /etc/letsencrypt/live/ronaronica.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/ronaronica.com/privkey.pem;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-GCM-SHA256;

ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_prefer_server_ciphers on;
# A future version of Nginx will support TLSv1.3
ssl_protocols TLSv1.2;
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 20m;
ssl_stapling on;
ssl_stapling_verify on;

ssl_trusted_certificate /etc/letsencrypt/live/ronaronica.com/chain.pem;

##
# Proxy Settings
##
proxy_cache_path /var/www/ronaronica.com/cache/ keys_zone=one:10m inactive=60m use_temp_path=off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
##
# Logging
##
error_log /var/log/nginx/error.log debug;

Attachments (1)

nginx-extension.conf (2.1 KB ) - added by ronaronica@… 6 years ago.

Download all attachments as: .zip

Change History (3)

by ronaronica@…, 6 years ago

Attachment: nginx-extension.conf added

comment:1 by ronaronica@…, 6 years ago

Sorry for putting code in description.

comment:2 by Maxim Dounin, 6 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #947.

Note: See TracTickets for help on using tickets.