Skip to content

Instantly share code, notes, and snippets.

@vbem
Created March 12, 2020 14:55
Show Gist options
  • Select an option

  • Save vbem/ae54100127ee03ee64896c58cf4996f4 to your computer and use it in GitHub Desktop.

Select an option

Save vbem/ae54100127ee03ee64896c58cf4996f4 to your computer and use it in GitHub Desktop.
example nginx.conf
# http://nginx.org/en/docs/ngx_core_module.html
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {
use epoll;
multi_accept on;
worker_connections 1024;
} # events
# http://nginx.org/en/docs/http/ngx_http_core_module.html
http {
# http://nginx.org/en/docs/http/ngx_http_core_module.html
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 600;
include mime.types;
default_type application/octet-stream;
server_tokens off;
log_not_found on;
log_subrequest on;
# http://nginx.org/en/docs/http/ngx_http_limit_conn_module.html
limit_conn_zone $binary_remote_addr zone=addr:10m;
limit_conn addr 32;
# http://nginx.org/en/docs/http/ngx_http_charset_module.html
charset utf-8;
# http://nginx.org/en/docs/http/ngx_http_gzip_module.html
gzip on;
gzip_comp_level 9;
gzip_min_length 0;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
gzip_types text/css text/xml text/plain application/javascript application/json;
# http://nginx.org/en/docs/http/ngx_http_autoindex_module.html
autoindex_localtime on;
autoindex_exact_size off;
# http://nginx.org/en/docs/http/ngx_http_log_module.html
log_format long '--------------------------------------------------------------------------------\n'
'time and elapsed: $time_iso8601 (elapsed ${request_time}s)\n'
'request from: $remote_user@$remote_addr:$remote_port (XFF: $http_x_forwarded_for) $http_user_agent\n'
'request to: $scheme $http_host $request\n'
'req/res size: ${request_length}B/${bytes_sent}B\n'
'req/res status: $request_completion/$status\n'
'vhost server: $server_name:$server_port';
log_format short '$time_iso8601 <$server_name:$server_port|$status> <$remote_addr|$scheme|$http_host|$request>';
access_log /var/log/nginx/access.log short;
server {
server_name "";
listen 81 default_server;
root /;
autoindex on;
default_type text/plain;
location = /favicon.ico {
return 302 http://nginx.org/favicon.ico;
}
location / {
}
} # server
} # http
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment