Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
user onehub onehub;
worker_processes 2;
pid /var/run/nginx.pid;
error_log /var/log/nginx/error.log info;
events {
worker_connections 8192;
use epoll;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent "$http_referer" '
'"$http_user_agent" '
'"$request_time" "$upstream_response_time" '
'$content_length';
sendfile on;
tcp_nopush on;
tcp_nodelay off;
# 2GB upload
client_max_body_size 2048M;
client_body_temp_path /data/nginx_tmp/incoming;
client_body_buffer_size 5m;
large_client_header_buffers 8 8k;
recursive_error_pages on;
# Proxy Settings
proxy_buffering off;
upstream webservers {
server 10.0.0.1:80 max_fails=3;
server 10.0.0.2:80 max_fails=3;
server 10.0.0.3:80 max_fails=3;
server 10.0.0.4:80 max_fails=3;
server 10.0.0.5:80 max_fails=3;
server 10.0.0.6:80 max_fails=3;
}
server {
listen 80;
server_name _;
root /usr/share/nginx/html/;
access_log /var/log/nginx/access.log main;
location / {
set $start_time_header '';
if ($request_method = GET) {
set $start_time_header 't=$start_time';
}
proxy_set_header X-Request-Start $start_time_header;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto http;
proxy_redirect off;
proxy_read_timeout 65;
proxy_pass http://webservers;
}
}
server {
listen 443;
server_name _;
root /usr/share/nginx/html/;
access_log /var/log/nginx/access.log main;
ssl on;
ssl_certificate certs/server.crt;
ssl_certificate_key certs/server.key;
location / {
set $start_time_header '';
if ($request_method = GET) {
set $start_time_header 't=$start_time';
}
proxy_set_header X-Request-Start $start_time_header;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_redirect off;
proxy_read_timeout 65;
proxy_pass http://webservers;
}
}
server {
listen 80;
server_name localhost;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.