summaryrefslogtreecommitdiffstats
path: root/syntax/nginx.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2017-05-17 11:28:13 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2017-05-17 11:28:13 +0200
commit7dd2e1169849b7e5cae67d5056f0a379f3da67b5 (patch)
treeba85e65b887c6a77e8400627e0f7ea7c0f08b84c /syntax/nginx.vim
parent9197c69900514524a0101d88e663b452de09a98d (diff)
downloadvim-polyglot-2.16.0.tar.gz
vim-polyglot-2.16.0.zip
Switch nginx vendor to chr4/nginx.vim, closes #205v2.16.0
Diffstat (limited to 'syntax/nginx.vim')
-rw-r--r--syntax/nginx.vim383
1 files changed, 228 insertions, 155 deletions
diff --git a/syntax/nginx.vim b/syntax/nginx.vim
index 1c55bd41..fbd29041 100644
--- a/syntax/nginx.vim
+++ b/syntax/nginx.vim
@@ -2,58 +2,64 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nginx') == -1
" Vim syntax file
" Language: nginx.conf
+" Maintainer: Chris Aumann <me@chr4.org>
+" Last Change: Apr 15, 2017
if exists("b:current_syntax")
finish
end
-" Patch 7.4.1142
-if has("patch-7.4-1142")
- if has("win32")
- syn iskeyword @,48-57,_,128-167,224-235,.,/,:,-
- else
- syn iskeyword @,48-57,_,192-255,.,/,:,-
- endif
-endif
+let b:current_syntax = "nginx"
syn match ngxVariable '\$\(\w\+\|{\w\+}\)'
+syn match ngxVariableBlock '\$\(\w\+\|{\w\+}\)' contained
syn match ngxVariableString '\$\(\w\+\|{\w\+}\)' contained
+syn region ngxBlock start=+^+ end=+{+ skip=+\${\|{{\|{%+ contains=ngxComment,ngxInteger,ngxIPaddr,ngxDirectiveBlock,ngxVariableBlock,ngxString,ngxThirdPartyLuaBlock oneline
+syn region ngxString start=+[^:a-zA-Z>!\\@]\z(["']\)+lc=1 end=+\z1+ skip=+\\\\\|\\\z1+ contains=ngxVariableString,ngxSSLCipherInsecure
syn match ngxComment ' *#.*$'
-syn match ngxLocationPath /\S\+/ contained
-syn region ngxString start=+[^:a-zA-Z>!\\@]\z(["']\)+lc=1 end=+\z1+ skip=+\\\\\|\\\z1+ contains=ngxVariableString
+
+" These regular expressions where taken (and adapted) from
+" http://vim.1045645.n5.nabble.com/IPv6-support-for-quot-dns-quot-zonefile-syntax-highlighting-td1197292.html
+syn match ngxInteger '\W\zs\(\d[0-9.]*\|[0-9.]*\d\)\w\?\ze\W'
+syn match ngxIPaddr '\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}'
+syn match ngxIPaddr '\[\(\x\{1,4}:\)\{6}\(\x\{1,4}:\x\{1,4}\|\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\]'
+syn match ngxIPaddr '\[::\(\(\x\{1,4}:\)\{,6}\x\{1,4}\|\(\x\{1,4}:\)\{,5}\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\]'
+syn match ngxIPaddr '\[\(\x\{1,4}:\)\{1}:\(\(\x\{1,4}:\)\{,5}\x\{1,4}\|\(\x\{1,4}:\)\{,4}\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\]'
+syn match ngxIPaddr '\[\(\x\{1,4}:\)\{2}:\(\(\x\{1,4}:\)\{,4}\x\{1,4}\|\(\x\{1,4}:\)\{,3}\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\]'
+syn match ngxIPaddr '\[\(\x\{1,4}:\)\{3}:\(\(\x\{1,4}:\)\{,3}\x\{1,4}\|\(\x\{1,4}:\)\{,2}\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\]'
+syn match ngxIPaddr '\[\(\x\{1,4}:\)\{4}:\(\(\x\{1,4}:\)\{,2}\x\{1,4}\|\(\x\{1,4}:\)\{,1}\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\]'
+syn match ngxIPaddr '\[\(\x\{1,4}:\)\{5}:\(\(\x\{1,4}:\)\{,1}\x\{1,4}\|\([0-2]\?\d\{1,2}\.\)\{3}[0-2]\?\d\{1,2}\)\]'
+syn match ngxIPaddr '\[\(\x\{1,4}:\)\{6}:\x\{1,4}\]'
+
+" Highlight wildcard listening signs also as IPaddr
+syn match ngxIPaddr '\s\zs\[::]'
+syn match ngxIPaddr '\s\zs\*'
syn keyword ngxBoolean on
syn keyword ngxBoolean off
-" Number and Measures http://nginx.org/en/docs/syntax.html
-syn match ngxNumber '\<\d\+\>'
-syn match ngxMeasure '\<\d\+ms\>'
-syn match ngxMeasure '\<\d\+[smhdwMy]\>'
-syn match ngxMeasure '\<\d\+[kKmMgG]\>'
-
-syn keyword ngxDirectiveBlock http
-syn keyword ngxDirectiveBlock mail
-syn keyword ngxDirectiveBlock events
-syn keyword ngxDirectiveBlock server
-syn keyword ngxDirectiveBlock stream
-syn keyword ngxDirectiveBlock types
-syn match ngxLocationOperator /\(=\|\~\*\|\^\~\|\~\)/ contained nextgroup=ngxLocationPath,ngxString skipwhite skipempty
-syn match ngxLocationNamedLoc /@\w\+/
-syn keyword ngxDirectiveBlock location nextgroup=ngxLocationNamedLoc,ngxLocationOperator,ngxLocationPath,ngxString skipwhite skipempty
-syn keyword ngxDirectiveBlock upstream
-syn keyword ngxDirectiveBlock charset_map
-syn keyword ngxDirectiveBlock limit_except
-syn keyword ngxDirectiveBlock if
-syn keyword ngxDirectiveBlock geo
-syn keyword ngxDirectiveBlock map
-syn keyword ngxDirectiveBlock split_clients
+syn keyword ngxDirectiveBlock http contained
+syn keyword ngxDirectiveBlock mail contained
+syn keyword ngxDirectiveBlock events contained
+syn keyword ngxDirectiveBlock server contained
+syn keyword ngxDirectiveBlock match contained
+syn keyword ngxDirectiveBlock types contained
+syn keyword ngxDirectiveBlock location contained
+syn keyword ngxDirectiveBlock upstream contained
+syn keyword ngxDirectiveBlock charset_map contained
+syn keyword ngxDirectiveBlock limit_except contained
+syn keyword ngxDirectiveBlock if contained
+syn keyword ngxDirectiveBlock geo contained
+syn keyword ngxDirectiveBlock map contained
+syn keyword ngxDirectiveBlock split_clients contained
syn keyword ngxDirectiveImportant include
syn keyword ngxDirectiveImportant root
-syn keyword ngxDirectiveImportant server
+syn keyword ngxDirectiveImportant server contained
+syn region ngxDirectiveImportantServer matchgroup=ngxDirectiveImportant start=+^\s*\zsserver\ze\s.*;+ skip=+\\\\\|\\\;+ end=+;+he=e-1 contains=ngxUpstreamServerOptions,ngxString,ngxIPaddr,ngxBoolean,ngxInteger,ngxTemplateVar
syn keyword ngxDirectiveImportant server_name
syn keyword ngxDirectiveImportant listen contained
-syn region ngxDirectiveImportantListen matchgroup=ngxDirectiveImportant start=+listen+ skip=+\\\\\|\\\;+ end=+;+he=e-1 contains=ngxListenOptions,ngxNumber,ngxString
+syn region ngxDirectiveImportantListen matchgroup=ngxDirectiveImportant start=+listen+ skip=+\\\\\|\\\;+ end=+;+he=e-1 contains=ngxListenOptions,ngxString,ngxIPaddr,ngxBoolean,ngxInteger,ngxTemplateVar
syn keyword ngxDirectiveImportant internal
syn keyword ngxDirectiveImportant proxy_pass
syn keyword ngxDirectiveImportant memcached_pass
@@ -61,6 +67,20 @@ syn keyword ngxDirectiveImportant fastcgi_pass
syn keyword ngxDirectiveImportant scgi_pass
syn keyword ngxDirectiveImportant uwsgi_pass
syn keyword ngxDirectiveImportant try_files
+syn keyword ngxDirectiveImportant error_page
+syn keyword ngxDirectiveImportant post_action
+
+syn keyword ngxUpstreamServerOptions weight contained
+syn keyword ngxUpstreamServerOptions max_conns contained
+syn keyword ngxUpstreamServerOptions max_fails contained
+syn keyword ngxUpstreamServerOptions fail_timeout contained
+syn keyword ngxUpstreamServerOptions backup contained
+syn keyword ngxUpstreamServerOptions down contained
+syn keyword ngxUpstreamServerOptions resolve contained
+syn keyword ngxUpstreamServerOptions route contained
+syn keyword ngxUpstreamServerOptions service contained
+syn keyword ngxUpstreamServerOptions default_server contained
+syn keyword ngxUpstreamServerOptions slow_start contained
syn keyword ngxListenOptions default_server contained
syn keyword ngxListenOptions ssl contained
@@ -81,29 +101,10 @@ syn keyword ngxListenOptions so_keepalive contained
syn keyword ngxListenOptions keepidle contained
syn keyword ngxDirectiveControl break
-syn keyword ngxDirectiveControl return nextgroup=ngxStatusCode skipwhite skipempty
-syn keyword ngxDirectiveControl rewrite nextgroup=ngxRewriteURI skipwhite skipempty
+syn keyword ngxDirectiveControl return
+syn keyword ngxDirectiveControl rewrite
syn keyword ngxDirectiveControl set
-syn match ngxStatusCode /\d\d\d/ contained
-syn match ngxStatusCodes /\d\d\d/ contained contains=ngxStatusCode nextgroup=ngxStatusCode skipwhite skipempty
-
-syn match ngxRewriteURI /\S\+/ contained contains=ngxVariableString nextgroup=ngxRewritedURI skipwhite skipempty
-syn region ngxRewriteURI start=+[^:a-zA-Z>!\\@]\z(["']\)+lc=1 end=+\z1+ skip=+\\\\\|\\\z1+ contained contains=ngxVariableString nextgroup=ngxRewritedURI skipwhite skipempty
-syn match ngxRewritedURI /\S\+/ contained contains=ngxVariableString nextgroup=ngxRewriteFlag skipwhite skipempty
-syn region ngxRewritedURI start=+[^:a-zA-Z>!\\@]\z(["']\)+lc=1 end=+\z1+ skip=+\\\\\|\\\z1+ contained contains=ngxVariableString nextgroup=ngxRewriteFlag skipwhite skipempty
-
-syn keyword ngxRewriteFlag last contained
-syn keyword ngxRewriteFlag break contained
-syn keyword ngxRewriteFlag redirect contained
-syn keyword ngxRewriteFlag permanent contained
-
-syn keyword ngxDirectiveError error_page nextgroup=ngxErrorStatusCode skipwhite skipempty
-syn keyword ngxDirectiveError post_action
-
-syn match ngxErrorStatusCode /\d\d\d/ contained contains=ngxStatusCode nextgroup=ngxErrorResponseCode skipwhite skipempty
-syn match ngxErrorResponseCode /=\d\d\d/ contained contains=ngxStatusCode
-
syn keyword ngxDirectiveDeprecated connections
syn keyword ngxDirectiveDeprecated imap
syn keyword ngxDirectiveDeprecated limit_zone
@@ -142,10 +143,7 @@ syn keyword ngxDirective autoindex
syn keyword ngxDirective autoindex_exact_size
syn keyword ngxDirective autoindex_format
syn keyword ngxDirective autoindex_localtime
-syn keyword ngxDirective charset nextgroup=ngxCharset skipwhite skipempty
-
-syn keyword ngxCharset utf-8 UTF-8
-
+syn keyword ngxDirective charset
syn keyword ngxDirective charset_map
syn keyword ngxDirective charset_types
syn keyword ngxDirective chunked_transfer_encoding
@@ -238,7 +236,9 @@ syn keyword ngxDirective geoip_proxy_recursive
syn keyword ngxDirective google_perftools_profiles
syn keyword ngxDirective gunzip
syn keyword ngxDirective gunzip_buffers
-syn keyword ngxDirective gzip
+syn keyword ngxDirective gzip nextgroup=ngxGzipOn,ngxGzipOff skipwhite
+syn keyword ngxGzipOn on contained
+syn keyword ngxGzipOff off contained
syn keyword ngxDirective gzip_buffers
syn keyword ngxDirective gzip_comp_level
syn keyword ngxDirective gzip_disable
@@ -301,13 +301,13 @@ syn keyword ngxDirective least_conn
syn keyword ngxDirective least_time
syn keyword ngxDirective limit_conn
syn keyword ngxDirective limit_conn_log_level
-syn keyword ngxDirective limit_conn_status nextgroup=ngxStatusCode skipwhite skipempty
+syn keyword ngxDirective limit_conn_status
syn keyword ngxDirective limit_conn_zone
syn keyword ngxDirective limit_rate
syn keyword ngxDirective limit_rate_after
syn keyword ngxDirective limit_req
syn keyword ngxDirective limit_req_log_level
-syn keyword ngxDirective limit_req_status nextgroup=ngxStatusCode skipwhite skipempty
+syn keyword ngxDirective limit_req_status
syn keyword ngxDirective limit_req_zone
syn keyword ngxDirective lingering_close
syn keyword ngxDirective lingering_time
@@ -319,7 +319,6 @@ syn keyword ngxDirective log_not_found
syn keyword ngxDirective log_subrequest
syn keyword ngxDirective map_hash_bucket_size
syn keyword ngxDirective map_hash_max_size
-syn keyword ngxDirective match
syn keyword ngxDirective master_process
syn keyword ngxDirective max_ranges
syn keyword ngxDirective memcached_bind
@@ -367,7 +366,7 @@ syn keyword ngxDirective postpone_gzipping
syn keyword ngxDirective postpone_output
syn keyword ngxDirective preread_buffer_size
syn keyword ngxDirective preread_timeout
-syn keyword ngxDirective protocol nextgroup=ngxMailProtocol skipwhite skipempty
+syn keyword ngxDirective protocol nextgroup=ngxMailProtocol skipwhite
syn keyword ngxMailProtocol imap pop3 smtp contained
syn keyword ngxDirective proxy
syn keyword ngxDirective proxy_bind
@@ -390,7 +389,7 @@ syn keyword ngxDirective proxy_cache_path
syn keyword ngxDirective proxy_cache_purge
syn keyword ngxDirective proxy_cache_revalidate
syn keyword ngxDirective proxy_cache_use_stale
-syn keyword ngxDirective proxy_cache_valid nextgroup=ngxStatusCodes skipwhite skipempty
+syn keyword ngxDirective proxy_cache_valid
syn keyword ngxDirective proxy_connect_timeout
syn keyword ngxDirective proxy_cookie_domain
syn keyword ngxDirective proxy_cookie_path
@@ -406,7 +405,8 @@ syn keyword ngxDirective proxy_intercept_errors
syn keyword ngxDirective proxy_limit_rate
syn keyword ngxDirective proxy_max_temp_file_size
syn keyword ngxDirective proxy_method
-syn keyword ngxDirective proxy_next_upstream
+syn keyword ngxDirective proxy_next_upstream contained
+syn region ngxDirectiveProxyNextUpstream matchgroup=ngxDirective start=+^\s*\zsproxy_next_upstream\ze\s.*;+ skip=+\\\\\|\\\;+ end=+;+he=e-1 contains=ngxProxyNextUpstreamOptions,ngxString,ngxTemplateVar
syn keyword ngxDirective proxy_next_upstream_timeout
syn keyword ngxDirective proxy_next_upstream_tries
syn keyword ngxDirective proxy_no_cache
@@ -430,7 +430,7 @@ syn keyword ngxDirective proxy_ssl_ciphers
syn keyword ngxDirective proxy_ssl_crl
syn keyword ngxDirective proxy_ssl_name
syn keyword ngxDirective proxy_ssl_password_file
-syn keyword ngxDirective proxy_ssl_protocols nextgroup=ngxSSLProtocol skipwhite skipempty
+syn keyword ngxDirective proxy_ssl_protocols nextgroup=ngxSSLProtocol skipwhite
syn keyword ngxDirective proxy_ssl_server_name
syn keyword ngxDirective proxy_ssl_session_reuse
syn keyword ngxDirective proxy_ssl_trusted_certificate
@@ -550,13 +550,28 @@ syn keyword ngxDirective ssl_ecdh_curve
syn keyword ngxDirective ssl_engine
syn keyword ngxDirective ssl_handshake_timeout
syn keyword ngxDirective ssl_password_file
-syn keyword ngxDirective ssl_prefer_server_ciphers
+syn keyword ngxDirective ssl_prefer_server_ciphers nextgroup=ngxSSLPreferServerCiphersOff,ngxSSLPreferServerCiphersOn skipwhite
+syn keyword ngxSSLPreferServerCiphersOn on contained
+syn keyword ngxSSLPreferServerCiphersOff off contained
syn keyword ngxDirective ssl_preread
-syn keyword ngxDirective ssl_protocols nextgroup=ngxSSLProtocol skipwhite skipempty
-syn keyword ngxSSLProtocol SSLv2 SSLv3 TLSv1 TLSv1.1 TLSv1.2 contained nextgroup=ngxSSLProtocol skipwhite skipempty
+syn keyword ngxDirective ssl_protocols nextgroup=ngxSSLProtocol,ngxSSLProtocolDeprecated skipwhite
+syn match ngxSSLProtocol 'TLSv1' contained nextgroup=ngxSSLProtocol,ngxSSLProtocolDeprecated skipwhite
+syn match ngxSSLProtocol 'TLSv1\.1' contained nextgroup=ngxSSLProtocol,ngxSSLProtocolDeprecated skipwhite
+syn match ngxSSLProtocol 'TLSv1\.2' contained nextgroup=ngxSSLProtocol,ngxSSLProtocolDeprecated skipwhite
+
+" Do not enable highlighting of insecure protocols if sslecure is loaded
+if !exists('g:loaded_sslsecure')
+ syn keyword ngxSSLProtocolDeprecated SSLv2 SSLv3 contained nextgroup=ngxSSLProtocol,ngxSSLProtocolDeprecated skipwhite
+else
+ syn match ngxSSLProtocol 'SSLv2' contained nextgroup=ngxSSLProtocol,ngxSSLProtocolDeprecated skipwhite
+ syn match ngxSSLProtocol 'SSLv3' contained nextgroup=ngxSSLProtocol,ngxSSLProtocolDeprecated skipwhite
+endif
+
syn keyword ngxDirective ssl_session_cache
syn keyword ngxDirective ssl_session_ticket_key
-syn keyword ngxDirective ssl_session_tickets
+syn keyword ngxDirective ssl_session_tickets nextgroup=ngxSSLSessionTicketsOn,ngxSSLSessionTicketsOff skipwhite
+syn keyword ngxSSLSessionTicketsOn on contained
+syn keyword ngxSSLSessionTicketsOff off contained
syn keyword ngxDirective ssl_session_timeout
syn keyword ngxDirective ssl_stapling
syn keyword ngxDirective ssl_stapling_file
@@ -570,8 +585,9 @@ syn keyword ngxDirective state
syn keyword ngxDirective status
syn keyword ngxDirective status_format
syn keyword ngxDirective status_zone
-syn keyword ngxDirective sticky
-syn keyword ngxDirective sticky_cookie_insert
+syn keyword ngxDirective sticky contained
+syn keyword ngxDirective sticky_cookie_insert contained
+syn region ngxDirectiveSticky matchgroup=ngxDirective start=+^\s*\zssticky\ze\s.*;+ skip=+\\\\\|\\\;+ end=+;+he=e-1 contains=ngxCookieOptions,ngxString,ngxBoolean,ngxInteger,ngxTemplateVar
syn keyword ngxDirective stub_status
syn keyword ngxDirective sub_filter
syn keyword ngxDirective sub_filter_last_modified
@@ -644,7 +660,7 @@ syn keyword ngxDirective uwsgi_ssl_ciphers
syn keyword ngxDirective uwsgi_ssl_crl
syn keyword ngxDirective uwsgi_ssl_name
syn keyword ngxDirective uwsgi_ssl_password_file
-syn keyword ngxDirective uwsgi_ssl_protocols nextgroup=ngxSSLProtocol skipwhite skipempty
+syn keyword ngxDirective uwsgi_ssl_protocols nextgroup=ngxSSLProtocol skipwhite
syn keyword ngxDirective uwsgi_ssl_server_name
syn keyword ngxDirective uwsgi_ssl_session_reuse
syn keyword ngxDirective uwsgi_ssl_trusted_certificate
@@ -677,6 +693,75 @@ syn keyword ngxDirective xslt_stylesheet
syn keyword ngxDirective xslt_types
syn keyword ngxDirective zone
+" Do not enable highlighting of insecure ciphers if sslecure is loaded
+if !exists('g:loaded_sslsecure')
+ " Mark insecure SSL Ciphers (Note: List might not not complete)
+ " Reference: https://www.openssl.org/docs/man1.0.2/apps/ciphers.html
+ syn match ngxSSLCipherInsecure '[^!]\zsSSLv3'
+ syn match ngxSSLCipherInsecure '[^!]\zsSSLv2'
+ syn match ngxSSLCipherInsecure '[^!]\zsHIGH'
+ syn match ngxSSLCipherInsecure '[^!]\zsMEDIUM'
+ syn match ngxSSLCipherInsecure '[^!]\zsLOW'
+ syn match ngxSSLCipherInsecure '[^!]\zsDEFAULT'
+ syn match ngxSSLCipherInsecure '[^!]\zsCOMPLEMENTOFDEFAULT'
+ syn match ngxSSLCipherInsecure '[^!]\zsALL'
+ syn match ngxSSLCipherInsecure '[^!]\zsCOMPLEMENTOFALL'
+
+ syn match ngxSSLCipherInsecure '[^!]\zsSHA\ze\D' " Match SHA1 without matching SHA256+
+ syn match ngxSSLCipherInsecure '[^!]\zsSHA1'
+ syn match ngxSSLCipherInsecure '[^!]\zsMD5'
+ syn match ngxSSLCipherInsecure '[^!]\zsRC2'
+ syn match ngxSSLCipherInsecure '[^!]\zsRC4'
+ syn match ngxSSLCipherInsecure '[^!]\zs3DES'
+ syn match ngxSSLCipherInsecure '[^!3]\zsDES'
+ syn match ngxSSLCipherInsecure '[^!]\zsaDSS'
+ syn match ngxSSLCipherInsecure '[^!a]\zsDSS'
+ syn match ngxSSLCipherInsecure '[^!]\zsPSK'
+ syn match ngxSSLCipherInsecure '[^!]\zsIDEA'
+ syn match ngxSSLCipherInsecure '[^!]\zsSEED'
+ syn match ngxSSLCipherInsecure '[^!]\zsEXP\w*' " Match all EXPORT ciphers
+ syn match ngxSSLCipherInsecure '[^!]\zsaGOST\w*' " Match all GOST ciphers
+ syn match ngxSSLCipherInsecure '[^!]\zskGOST\w*'
+ syn match ngxSSLCipherInsecure '[^!ak]\zsGOST\w*'
+ syn match ngxSSLCipherInsecure '[^!]\zs[kae]\?FZA' " Not implemented
+ syn match ngxSSLCipherInsecure '[^!]\zsECB'
+ syn match ngxSSLCipherInsecure '[^!]\zs[aes]NULL'
+
+ " Anonymous cipher suites should never be used
+ syn match ngxSSLCipherInsecure '[^!ECa]\zsDH\ze[^E]' " Try to match DH without DHE, EDH, EECDH, etc.
+ syn match ngxSSLCipherInsecure '[^!EA]\zsECDH\ze[^E]' " Do not match EECDH, ECDHE
+ syn match ngxSSLCipherInsecure '[^!]\zsADH'
+ syn match ngxSSLCipherInsecure '[^!]\zskDHE'
+ syn match ngxSSLCipherInsecure '[^!]\zskEDH'
+ syn match ngxSSLCipherInsecure '[^!]\zskECDHE'
+ syn match ngxSSLCipherInsecure '[^!]\zskEECDH'
+ syn match ngxSSLCipherInsecure '[^!E]\zsAECDH'
+endif
+
+syn keyword ngxProxyNextUpstreamOptions error contained
+syn keyword ngxProxyNextUpstreamOptions timeout contained
+syn keyword ngxProxyNextUpstreamOptions invalid_header contained
+syn keyword ngxProxyNextUpstreamOptions http_500 contained
+syn keyword ngxProxyNextUpstreamOptions http_502 contained
+syn keyword ngxProxyNextUpstreamOptions http_503 contained
+syn keyword ngxProxyNextUpstreamOptions http_504 contained
+syn keyword ngxProxyNextUpstreamOptions http_403 contained
+syn keyword ngxProxyNextUpstreamOptions http_404 contained
+syn keyword ngxProxyNextUpstreamOptions http_429 contained
+syn keyword ngxProxyNextUpstreamOptions non_idempotent contained
+syn keyword ngxProxyNextUpstreamOptions off contained
+
+syn keyword ngxStickyOptions cookie contained
+syn region ngxStickyOptionsCookie matchgroup=ngxStickyOptions start=+^\s*\zssticky\s\s*cookie\ze\s.*;+ skip=+\\\\\|\\\;+ end=+;+he=e-1 contains=ngxCookieOptions,ngxString,ngxBoolean,ngxInteger,ngxTemplateVar
+syn keyword ngxStickyOptions route contained
+syn keyword ngxStickyOptions learn contained
+
+syn keyword ngxCookieOptions expires contained
+syn keyword ngxCookieOptions domain contained
+syn keyword ngxCookieOptions httponly contained
+syn keyword ngxCookieOptions secure contained
+syn keyword ngxCookieOptions path contained
+
" 3rd party module list:
" https://www.nginx.com/resources/wiki/modules/
@@ -956,48 +1041,7 @@ syn keyword ngxDirectiveDeprecated geoip_country_file
" GeoIP 2 Module <https://github.com/leev/ngx_http_geoip2_module>
" Creates variables with values from the maxmind geoip2 databases based on the client IP
-syn keyword ngxDirectiveThirdParty geoip2 nextgroup=ngxThirdPartyGeoIP2Database skipwhite skipempty
-syn match ngxThirdPartyGeoIP2Database /\S\+/ contained nextgroup=ngxThirdPartyGeoIP2Block skipwhite skipempty
-syn region ngxThirdPartyGeoIP2Block start=/{/ end=/}/ contained contains=ngxThirdPartyGeoIP2Keyword,ngxVariable
-syn keyword ngxThirdPartyGeoIP2Keyword de en es fr ja pt-BR ru zh-CN contained
-syn match ngxThirdPartyGeoIP2Keyword /pt-BR|zh-CN/ contained
-syn keyword ngxThirdPartyGeoIP2Keyword default source contained
-" Common Keys
-syn keyword ngxThirdPartyGeoIP2Keyword code confidence geoname_id names iso_code contained
-" /Common Keys
-syn keyword ngxThirdPartyGeoIP2Keyword city contained
-syn keyword ngxThirdPartyGeoIP2Keyword continent contained
-syn keyword ngxThirdPartyGeoIP2Keyword country contained
-syn keyword ngxThirdPartyGeoIP2Keyword location contained
-" Location Keys
-syn keyword ngxThirdPartyGeoIP2Keyword accuracy_radius contained
-syn keyword ngxThirdPartyGeoIP2Keyword average_income contained
-syn keyword ngxThirdPartyGeoIP2Keyword latitude contained
-syn keyword ngxThirdPartyGeoIP2Keyword longitude contained
-syn keyword ngxThirdPartyGeoIP2Keyword metro_code contained
-syn keyword ngxThirdPartyGeoIP2Keyword population_density contained
-syn keyword ngxThirdPartyGeoIP2Keyword time_zone contained
-syn keyword ngxThirdPartyGeoIP2Keyword postal contained
-" /Location Keys
-syn keyword ngxThirdPartyGeoIP2Keyword registered_country contained
-syn keyword ngxThirdPartyGeoIP2Keyword represented_country contained
-" Represented Country Keys
-syn keyword ngxThirdPartyGeoIP2Keyword type contained
-" /Represented Country Keys
-syn keyword ngxThirdPartyGeoIP2Keyword subdivisions contained
-syn keyword ngxThirdPartyGeoIP2Keyword traits contained
-" Traits Keys
-syn keyword ngxThirdPartyGeoIP2Keyword autonomous_system_number contained
-syn keyword ngxThirdPartyGeoIP2Keyword autonomous_system_organization contained
-syn keyword ngxThirdPartyGeoIP2Keyword domain contained
-syn keyword ngxThirdPartyGeoIP2Keyword ip_address contained
-syn keyword ngxThirdPartyGeoIP2Keyword is_anonymous_proxy contained
-syn keyword ngxThirdPartyGeoIP2Keyword is_satellite_provider contained
-syn keyword ngxThirdPartyGeoIP2Keyword isp contained
-syn keyword ngxThirdPartyGeoIP2Keyword organization contained
-syn keyword ngxThirdPartyGeoIP2Keyword user_type contained
-" /Traits Keys
-hi link ngxThirdPartyGeoIP2Keyword ngxThirdPartyKeyword
+syn keyword ngxDirectiveThirdParty geoip2
" GridFS Module <https://github.com/mdirolf/nginx-gridfs>
" Nginx module for serving files from MongoDB's GridFS
@@ -1174,40 +1218,27 @@ syn keyword ngxDirectiveThirdParty lua_regex_match_limit
syn keyword ngxDirectiveThirdParty lua_package_path
syn keyword ngxDirectiveThirdParty lua_package_cpath
syn keyword ngxDirectiveThirdParty init_by_lua
-syn keyword ngxDirectiveThirdParty init_by_lua_block
syn keyword ngxDirectiveThirdParty init_by_lua_file
syn keyword ngxDirectiveThirdParty init_worker_by_lua
-syn keyword ngxDirectiveThirdParty init_worker_by_lua_block
syn keyword ngxDirectiveThirdParty init_worker_by_lua_file
syn keyword ngxDirectiveThirdParty set_by_lua
-syn keyword ngxDirectiveThirdParty set_by_lua_block
syn keyword ngxDirectiveThirdParty set_by_lua_file
syn keyword ngxDirectiveThirdParty content_by_lua
-syn keyword ngxDirectiveThirdParty content_by_lua_block
syn keyword ngxDirectiveThirdParty content_by_lua_file
syn keyword ngxDirectiveThirdParty rewrite_by_lua
-syn keyword ngxDirectiveThirdParty rewrite_by_lua_block
syn keyword ngxDirectiveThirdParty rewrite_by_lua_file
syn keyword ngxDirectiveThirdParty access_by_lua
-syn keyword ngxDirectiveThirdParty access_by_lua_block
syn keyword ngxDirectiveThirdParty access_by_lua_file
syn keyword ngxDirectiveThirdParty header_filter_by_lua
-syn keyword ngxDirectiveThirdParty header_filter_by_lua_block
syn keyword ngxDirectiveThirdParty header_filter_by_lua_file
syn keyword ngxDirectiveThirdParty body_filter_by_lua
-syn keyword ngxDirectiveThirdParty body_filter_by_lua_block
syn keyword ngxDirectiveThirdParty body_filter_by_lua_file
syn keyword ngxDirectiveThirdParty log_by_lua
-syn keyword ngxDirectiveThirdParty log_by_lua_block
syn keyword ngxDirectiveThirdParty log_by_lua_file
-syn keyword ngxDirectiveThirdParty balancer_by_lua_block
syn keyword ngxDirectiveThirdParty balancer_by_lua_file
syn keyword ngxDirectiveThirdParty lua_need_request_body
-syn keyword ngxDirectiveThirdParty ssl_certificate_by_lua_block
syn keyword ngxDirectiveThirdParty ssl_certificate_by_lua_file
-syn keyword ngxDirectiveThirdParty ssl_session_fetch_by_lua_block
syn keyword ngxDirectiveThirdParty ssl_session_fetch_by_lua_file
-syn keyword ngxDirectiveThirdParty ssl_session_store_by_lua_block
syn keyword ngxDirectiveThirdParty ssl_session_store_by_lua_file
syn keyword ngxDirectiveThirdParty lua_shared_dict
syn keyword ngxDirectiveThirdParty lua_socket_connect_timeout
@@ -2193,41 +2224,83 @@ syn keyword ngxDirectiveThirdParty xss_input_types
" ZIP Module <https://www.nginx.com/resources/wiki/modules/zip/>
" ZIP archiver for nginx
+" Contained LUA blocks for embedded syntax highlighting
+syn keyword ngxThirdPartyLuaBlock balancer_by_lua_block contained
+syn keyword ngxThirdPartyLuaBlock init_by_lua_block contained
+syn keyword ngxThirdPartyLuaBlock init_worker_by_lua_block contained
+syn keyword ngxThirdPartyLuaBlock set_by_lua_block contained
+syn keyword ngxThirdPartyLuaBlock content_by_lua_block contained
+syn keyword ngxThirdPartyLuaBlock rewrite_by_lua_block contained
+syn keyword ngxThirdPartyLuaBlock access_by_lua_block contained
+syn keyword ngxThirdPartyLuaBlock header_filter_by_lua_block contained
+syn keyword ngxThirdPartyLuaBlock body_filter_by_lua_block contained
+syn keyword ngxThirdPartyLuaBlock log_by_lua_block contained
+syn keyword ngxThirdPartyLuaBlock ssl_certificate_by_lua_block contained
+syn keyword ngxThirdPartyLuaBlock ssl_session_fetch_by_lua_block contained
+syn keyword ngxThirdPartyLuaBlock ssl_session_store_by_lua_block contained
+
+
+" Nested syntax in ERB templating statements
+" Subtype needs to be set to '', otherwise recursive errors occur when opening *.nginx files
+let b:eruby_subtype = ''
+unlet b:current_syntax
+syn include @ERB syntax/eruby.vim
+syn region ngxTemplate start=+<%[^\=]+ end=+%>+ oneline contains=@ERB
+syn region ngxTemplateVar start=+<%=+ end=+%>+ oneline
+let b:current_syntax = "nginx"
+
+" Nested syntax in Jinja templating statements
+" This dependend on https://github.com/lepture/vim-jinja
+unlet b:current_syntax
+try
+ syn include @JINJA syntax/jinja.vim
+ syn region ngxTemplate start=+{%+ end=+%}+ oneline contains=@JINJA
+ syn region ngxTemplateVar start=+{{+ end=+}}+ oneline
+catch
+endtry
+let b:current_syntax = "nginx"
+
+" Enable nested LUA syntax highlighting
+unlet b:current_syntax
+syn include @LUA syntax/lua.vim
+syn region ngxLua start=+^\s*\w\+_by_lua_block\s*{+ end=+}+me=s-1 contains=ngxBlock,@LUA
+let b:current_syntax = "nginx"
-" highlight
+" Highlight
hi link ngxComment Comment
-hi link ngxVariable PreProc
+hi link ngxVariable Identifier
+hi link ngxVariableBlock Identifier
hi link ngxVariableString PreProc
+hi link ngxBlock Normal
hi link ngxString String
-hi link ngxLocationPath String
-hi link ngxLocationNamedLoc PreProc
-
-hi link ngxDirective Identifier
+hi link ngxIPaddr Delimiter
+hi link ngxBoolean Boolean
+hi link ngxInteger Number
hi link ngxDirectiveBlock Statement
hi link ngxDirectiveImportant Type
hi link ngxDirectiveControl Keyword
-hi link ngxDirectiveError Constant
-hi link ngxDirectiveThirdParty Identifier
hi link ngxDirectiveDeprecated Error
-
-hi link ngxBoolean Boolean
-hi link ngxNumber Number
-hi link ngxMeasure Number
-hi link ngxStatusCode Number
-hi link ngxRewriteFlag Boolean
-
-hi link ngxCharset keyword
-hi link ngxListenOptions Keyword
+hi link ngxDirective Function
+hi link ngxDirectiveThirdParty Function
+hi link ngxListenOptions PreProc
+hi link ngxUpstreamServerOptions PreProc
+hi link ngxProxyNextUpstreamOptions PreProc
hi link ngxMailProtocol Keyword
-hi link ngxSSLProtocol Keyword
-
-hi link ngxRewriteURI Special
-hi link ngxRewritedURI StorageClass
-
-hi link ngxThirdPartyKeyword keyword
-
-let b:current_syntax = "nginx"
-
+hi link ngxSSLProtocol PreProc
+hi link ngxSSLProtocolDeprecated Error
+hi link ngxStickyOptions ngxDirective
+hi link ngxCookieOptions PreProc
+hi link ngxTemplateVar Identifier
+
+hi link ngxSSLSessionTicketsOff ngxBoolean
+hi link ngxSSLSessionTicketsOn Error
+hi link ngxSSLPreferServerCiphersOn ngxBoolean
+hi link ngxSSLPreferServerCiphersOff Error
+hi link ngxGzipOff ngxBoolean
+hi link ngxGzipOn Error
+hi link ngxSSLCipherInsecure Error
+
+hi link ngxThirdPartyLuaBlock Function
endif