Skip to content

Instantly share code, notes, and snippets.

@dome
Created August 23, 2024 05:20
Show Gist options
  • Save dome/d787a459e27fe9cd113dd38e5ecc26e7 to your computer and use it in GitHub Desktop.
Save dome/d787a459e27fe9cd113dd38e5ecc26e7 to your computer and use it in GitHub Desktop.
nginx proxy evm rpc
user nginx;
worker_processes auto;
error_log /dev/stderr warn;
pid /var/run/nginx.pid;
worker_rlimit_nofile 100000;
events {
worker_connections 102400;
multi_accept on;
use epoll;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
real_ip_header Cf-Connecting-Ip;
real_ip_recursive on;
# Cloudflare
# https://www.cloudflare.com/ips/
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 104.16.0.0/13;
set_real_ip_from 104.24.0.0/14;
set_real_ip_from 172.64.0.0/13;
set_real_ip_from 131.0.72.0/22;
limit_req_zone $binary_remote_addr zone=one:100m rate=50r/s;
limit_req zone=one burst=60;
limit_req_status 429;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log off; # /var/log/nginx/access.log main;
# cache informations about FDs, frequently accessed files
# can boost performance, but you need to test those values
open_file_cache max=200000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
sendfile on;
tcp_nodelay on;
tcp_nopush on;
keepalive_timeout 65;
server {
listen 80;
server_name _;
location / {
proxy_redirect off;
proxy_pass http://geth:8545/;
}
location = /basic_status {
stub_status;
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