mirror of
https://github.com/sharkdp/bat
synced 2024-11-18 15:26:16 +00:00
Add fairly complex nginx config.
This is to contribute to issue #1213. I took some of the more complicated servers I am running as examples. Everything looks to be correctly highlighted compared to vim's syntax highlighting.
This commit is contained in:
parent
efab00a9de
commit
99ac5c3045
140
tests/syntax-tests/highlighted/nginx/nginx.conf
Normal file
140
tests/syntax-tests/highlighted/nginx/nginx.conf
Normal file
@ -0,0 +1,140 @@
|
||||
[38;2;117;113;94m#user nobody;[0m
|
||||
[38;2;249;38;114mworker_processes[0m[38;2;255;255;255m [0m[38;2;230;219;116m1[0m[38;2;255;255;255m;[0m
|
||||
[38;2;117;113;94m#pid logs/nginx.pid;[0m
|
||||
|
||||
[38;2;249;38;114mload_module[0m[38;2;255;255;255m [0m[38;2;230;219;116m"/usr/local/libexec/nginx/ngx_http_xslt_filter_module.so"[0m[38;2;255;255;255m;[0m
|
||||
[38;2;249;38;114mload_module[0m[38;2;255;255;255m [0m[38;2;230;219;116m"/usr/local/libexec/nginx/ngx_rtmp_module.so"[0m[38;2;255;255;255m;[0m
|
||||
|
||||
[3;38;2;102;217;239mevents[0m[38;2;248;248;242m {[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mworker_connections[0m[38;2;255;255;255m [0m[38;2;230;219;116m1024[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m}[0m
|
||||
|
||||
[3;38;2;102;217;239mhttp[0m[38;2;248;248;242m {[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114minclude[0m[38;2;255;255;255m mime.types;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mdefault_type[0m[38;2;255;255;255m application/octet-stream;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114msendfile[0m[38;2;255;255;255m [0m[38;2;190;132;255m on[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mkeepalive_timeout[0m[38;2;255;255;255m [0m[38;2;230;219;116m65[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mgzip[0m[38;2;255;255;255m [0m[38;2;190;132;255m on[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mgzip_disable[0m[38;2;255;255;255m [0m[38;2;230;219;116m"msie6"[0m[38;2;255;255;255m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114minclude[0m[38;2;255;255;255m /usr/local/etc/nginx/sites.d/*;[0m
|
||||
[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;249;38;114mrtmp[0m[38;2;255;255;255m {[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mserver[0m[38;2;248;248;242m {[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlisten[0m[38;2;255;255;255m [0m[38;2;230;219;116m1935[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mmax_message[0m[38;2;255;255;255m 10M;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mapplication[0m[38;2;255;255;255m wnob {[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlive[0m[38;2;255;255;255m on;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrecord[0m[38;2;255;255;255m off;[0m
|
||||
[38;2;248;248;242m }[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mapplication[0m[38;2;255;255;255m strim {[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlive[0m[38;2;255;255;255m on;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mhls[0m[38;2;255;255;255m on;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mhls_path[0m[38;2;255;255;255m /usr/local/www/hls/;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mhls_variant[0m[38;2;255;255;255m _low BANDWIDTH=250000;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mhls_variant[0m[38;2;255;255;255m _mid BANDWIDTH=500000;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mhls_variant[0m[38;2;255;255;255m _high BANDWIDTH=1000000;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mhls_variant[0m[38;2;255;255;255m _hd720 BANDWIDTH=1500000;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mhls_variant[0m[38;2;255;255;255m _src BANDWIDTH=2000000;[0m
|
||||
[38;2;248;248;242m }[0m
|
||||
[38;2;248;248;242m }[0m
|
||||
[38;2;248;248;242m}[0m
|
||||
|
||||
[3;38;2;102;217;239mserver[0m[38;2;248;248;242m {[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlisten[0m[38;2;255;255;255m [0m[38;2;230;219;116m443[0m[38;2;255;255;255m ssl;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mserver_name[0m[38;2;255;255;255m host.example.com[0m
|
||||
[38;2;255;255;255m root /usr/local/www/host.example.com/;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114merror_page[0m[38;2;255;255;255m [0m[38;2;230;219;116m404[0m[38;2;255;255;255m /404.html;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mindex[0m[38;2;255;255;255m index.html;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mautoindex[0m[38;2;190;132;255m on[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mautoindex_localtime[0m[38;2;190;132;255m off[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mautoindex_format[0m[38;2;255;255;255m xml;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mlocation[0m[38;2;248;248;242m [0m[38;2;166;226;46m/ [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mxslt_stylesheet[0m[38;2;255;255;255m /usr/local/www/host.example.com/index.xslt;[0m
|
||||
[38;2;248;248;242m }[0m
|
||||
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mlocation[0m[38;2;248;248;242m ~ [0m[38;2;246;170;17m/\..* [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mreturn[0m[38;2;255;255;255m [0m[38;2;230;219;116m404[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m }[0m
|
||||
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mlocation[0m[38;2;248;248;242m ~ [0m[38;2;246;170;17m/.+/ [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mxslt_stylesheet[0m[38;2;255;255;255m /usr/local/www/host.example.com/project.xslt;[0m
|
||||
[38;2;248;248;242m }[0m
|
||||
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mlocation[0m[38;2;248;248;242m ~ [0m[38;2;246;170;17m/.*\.xslt/ [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mreturn[0m[38;2;255;255;255m [0m[38;2;230;219;116m404[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m }[0m
|
||||
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mlocation[0m[38;2;248;248;242m ~ [0m[38;2;246;170;17m\.thumb\.png$ [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114merror_page[0m[38;2;255;255;255m [0m[38;2;230;219;116m404[0m[38;2;255;255;255m /404.thumb.png;[0m
|
||||
[38;2;248;248;242m }[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mssl_certificate[0m[38;2;255;255;255m /usr/local/etc/letsencrypt/live/host.example.com/fullchain.pem;[0m[38;2;248;248;242m [0m[38;2;117;113;94m# managed by Certbot[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mssl_certificate_key[0m[38;2;255;255;255m /usr/local/etc/letsencrypt/live/host.example.com/privkey.pem;[0m[38;2;248;248;242m [0m[38;2;117;113;94m# managed by Certbot[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114minclude[0m[38;2;255;255;255m /usr/local/etc/letsencrypt/options-ssl-nginx.conf;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mssl_dhparam[0m[38;2;255;255;255m /usr/local/etc/letsencrypt/ssl-dhparams.pem;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114madd_header[0m[38;2;255;255;255m Strict-Transport-Security [0m[38;2;230;219;116m"max-age=31536000"[0m[38;2;255;255;255m always;[0m
|
||||
|
||||
[38;2;248;248;242m}[0m
|
||||
|
||||
[3;38;2;102;217;239mserver[0m[38;2;248;248;242m {[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlisten[0m[38;2;255;255;255m [0m[38;2;230;219;116m80[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mserver_name[0m[38;2;255;255;255m host.example.com;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m ([0m[38;2;255;255;255m$host[0m[38;2;248;248;242m = host.example.com) [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mreturn[0m[38;2;255;255;255m [0m[38;2;230;219;116m301[0m[38;2;255;255;255m https://[0m[38;2;255;255;255m$host[0m[38;2;255;255;255m$request_uri[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m }[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mreturn[0m[38;2;255;255;255m [0m[38;2;230;219;116m404[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m}[0m
|
||||
|
||||
[3;38;2;102;217;239mserver[0m[38;2;248;248;242m {[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlisten[0m[38;2;255;255;255m [0m[38;2;230;219;116m443[0m[38;2;255;255;255m ssl;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mserver_name[0m[38;2;255;255;255m other.example.com;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mssl_certificate[0m[38;2;255;255;255m /usr/local/etc/letsencrypt/live/other.example.com/fullchain.pem;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mssl_certificate_key[0m[38;2;255;255;255m /usr/local/etc/letsencrypt/live/other.example.com/privkey.pem;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114minclude[0m[38;2;255;255;255m /usr/local/etc/letsencrypt/options-ssl-nginx.conf;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mssl_dhparam[0m[38;2;255;255;255m /usr/local/etc/letsencrypt/ssl-dhparams.pem;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114madd_header[0m[38;2;255;255;255m Strict-Transport-Security [0m[38;2;230;219;116m"max-age=31536000"[0m[38;2;255;255;255m always;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114maccess_log[0m[38;2;255;255;255m /home/otherapp/logs/access.log;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114merror_log[0m[38;2;255;255;255m /home/otherapp/logs/error.log;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mclient_max_body_size[0m[38;2;255;255;255m [0m[38;2;190;132;255m5M[0m[38;2;255;255;255m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mlocation[0m[38;2;248;248;242m [0m[38;2;166;226;46m/ [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mroot[0m[38;2;255;255;255m /home/otherapp/app/static;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mindex[0m[38;2;255;255;255m man.txt;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mtry_files[0m[38;2;255;255;255m [0m[38;2;255;255;255m$uri[0m[38;2;255;255;255m @proxy;[0m
|
||||
[38;2;248;248;242m }[0m
|
||||
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mlocation[0m[38;2;248;248;242m [0m[38;2;166;226;46m@proxy [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mproxy_set_header[0m[38;2;255;255;255m Host [0m[38;2;255;255;255m$http_host[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mproxy_set_header[0m[38;2;255;255;255m X-Forwarded-Host [0m[38;2;255;255;255m$host[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mproxy_set_header[0m[38;2;255;255;255m X-Real-IP [0m[38;2;255;255;255m$remote_addr[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mproxy_set_header[0m[38;2;255;255;255m X-Forwarded-For [0m[38;2;255;255;255m$proxy_add_x_forwarded_for[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mproxy_pass[0m[38;2;255;255;255m http://unix:/var/run/otherapp/sock:;[0m
|
||||
[38;2;248;248;242m }[0m
|
||||
[38;2;248;248;242m}[0m
|
||||
|
||||
[3;38;2;102;217;239mserver[0m[38;2;248;248;242m {[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mlisten[0m[38;2;255;255;255m [0m[38;2;230;219;116m80[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mserver_name[0m[38;2;255;255;255m other.example.com;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m ([0m[38;2;255;255;255m$host[0m[38;2;248;248;242m = other.example.com) [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mreturn[0m[38;2;255;255;255m [0m[38;2;230;219;116m301[0m[38;2;255;255;255m https://[0m[38;2;255;255;255m$host[0m[38;2;255;255;255m$request_uri[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m }[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mreturn[0m[38;2;255;255;255m [0m[38;2;230;219;116m404[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m}[0m
|
140
tests/syntax-tests/source/nginx/nginx.conf
Normal file
140
tests/syntax-tests/source/nginx/nginx.conf
Normal file
@ -0,0 +1,140 @@
|
||||
#user nobody;
|
||||
worker_processes 1;
|
||||
#pid logs/nginx.pid;
|
||||
|
||||
load_module "/usr/local/libexec/nginx/ngx_http_xslt_filter_module.so";
|
||||
load_module "/usr/local/libexec/nginx/ngx_rtmp_module.so";
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
|
||||
include /usr/local/etc/nginx/sites.d/*;
|
||||
}
|
||||
|
||||
rtmp {
|
||||
server {
|
||||
listen 1935;
|
||||
max_message 10M;
|
||||
|
||||
application wnob {
|
||||
live on;
|
||||
record off;
|
||||
}
|
||||
|
||||
application strim {
|
||||
live on;
|
||||
hls on;
|
||||
|
||||
hls_path /usr/local/www/hls/;
|
||||
|
||||
hls_variant _low BANDWIDTH=250000;
|
||||
hls_variant _mid BANDWIDTH=500000;
|
||||
hls_variant _high BANDWIDTH=1000000;
|
||||
hls_variant _hd720 BANDWIDTH=1500000;
|
||||
hls_variant _src BANDWIDTH=2000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name host.example.com
|
||||
root /usr/local/www/host.example.com/;
|
||||
error_page 404 /404.html;
|
||||
|
||||
index index.html;
|
||||
autoindex on;
|
||||
autoindex_localtime off;
|
||||
autoindex_format xml;
|
||||
|
||||
location / {
|
||||
xslt_stylesheet /usr/local/www/host.example.com/index.xslt;
|
||||
}
|
||||
|
||||
location ~ /\..* {
|
||||
return 404;
|
||||
}
|
||||
|
||||
location ~ /.+/ {
|
||||
xslt_stylesheet /usr/local/www/host.example.com/project.xslt;
|
||||
}
|
||||
|
||||
location ~ /.*\.xslt/ {
|
||||
return 404;
|
||||
}
|
||||
|
||||
location ~ \.thumb\.png$ {
|
||||
error_page 404 /404.thumb.png;
|
||||
}
|
||||
ssl_certificate /usr/local/etc/letsencrypt/live/host.example.com/fullchain.pem; # managed by Certbot
|
||||
ssl_certificate_key /usr/local/etc/letsencrypt/live/host.example.com/privkey.pem; # managed by Certbot
|
||||
|
||||
include /usr/local/etc/letsencrypt/options-ssl-nginx.conf;
|
||||
ssl_dhparam /usr/local/etc/letsencrypt/ssl-dhparams.pem;
|
||||
|
||||
add_header Strict-Transport-Security "max-age=31536000" always;
|
||||
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name host.example.com;
|
||||
|
||||
if ($host = host.example.com) {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
return 404;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name other.example.com;
|
||||
|
||||
ssl_certificate /usr/local/etc/letsencrypt/live/other.example.com/fullchain.pem;
|
||||
ssl_certificate_key /usr/local/etc/letsencrypt/live/other.example.com/privkey.pem;
|
||||
|
||||
include /usr/local/etc/letsencrypt/options-ssl-nginx.conf;
|
||||
ssl_dhparam /usr/local/etc/letsencrypt/ssl-dhparams.pem;
|
||||
|
||||
add_header Strict-Transport-Security "max-age=31536000" always;
|
||||
|
||||
access_log /home/otherapp/logs/access.log;
|
||||
error_log /home/otherapp/logs/error.log;
|
||||
|
||||
client_max_body_size 5M;
|
||||
|
||||
location / {
|
||||
root /home/otherapp/app/static;
|
||||
index man.txt;
|
||||
try_files $uri @proxy;
|
||||
}
|
||||
|
||||
location @proxy {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://unix:/var/run/otherapp/sock:;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name other.example.com;
|
||||
|
||||
if ($host = other.example.com) {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
return 404;
|
||||
}
|
Loading…
Reference in New Issue
Block a user