70 lines
1.8 KiB
Nginx Configuration File
70 lines
1.8 KiB
Nginx Configuration File
worker_processes 1;
|
|
|
|
events { worker_connections 1024; }
|
|
|
|
# required for non root
|
|
pid /tmp/nginx.pid;
|
|
|
|
http {
|
|
|
|
# required for non root
|
|
client_body_temp_path /tmp/client_temp;
|
|
proxy_temp_path /tmp/proxy_temp_path;
|
|
fastcgi_temp_path /tmp/fastcgi_temp;
|
|
uwsgi_temp_path /tmp/uwsgi_temp;
|
|
scgi_temp_path /tmp/scgi_temp;
|
|
|
|
client_max_body_size 1m;
|
|
|
|
map $status $status_category {
|
|
"~^(?<code>(?<prefix>(?<category>[1-5])[0-9])[0-9])$" "$category";
|
|
}
|
|
|
|
map $status $status_prefix {
|
|
"~^(?<code>(?<prefix>(?<category>[1-5])[0-9])[0-9])$" "$prefix";
|
|
}
|
|
|
|
# header: $http_lowercase_name (- replaced with _)
|
|
map $http_x_forwarded_host $server_domain {
|
|
"~(?<domain_name>[a-zA-Z0-9-]*)(\.[a-z]*)$" "$domain_name";
|
|
}
|
|
|
|
server {
|
|
listen 8080 default_server;
|
|
|
|
# prevent redirecting to 8080 port
|
|
# (e.g. when trailing slash is missed)
|
|
port_in_redirect off;
|
|
|
|
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 421 422 423 424 425 426 428 429 431 451 500 501 502 503 504 505 506 507 508 510 511 @error;
|
|
|
|
set $upstream $http_x_forwarded_upstream;
|
|
|
|
location / {
|
|
root /service/html;
|
|
}
|
|
|
|
location ~^/index.html$ {
|
|
ssi on;
|
|
root /service/html;
|
|
}
|
|
|
|
location /errors { deny all; return 404; }
|
|
|
|
location @error {
|
|
root /service/html;
|
|
internal;
|
|
# replace variables in html
|
|
ssi on;
|
|
try_files
|
|
|
|
/errors/error_$status.html
|
|
/errors/error_${status_prefix}x.html
|
|
/errors/error_${status_category}xx.html
|
|
/errors/error.html;
|
|
|
|
}
|
|
}
|
|
|
|
}
|