Skip to content

Instantly share code, notes, and snippets.

@simpleton
Forked from jqlblue/sentry-nginx.conf
Last active February 4, 2017 09:05
Show Gist options
  • Save simpleton/c7d624602f007ac56b31 to your computer and use it in GitHub Desktop.
Save simpleton/c7d624602f007ac56b31 to your computer and use it in GitHub Desktop.
user nobody;
worker_processes auto;
error_log logs/error.log notice;
worker_rlimit_nofile 65535;
pid /var/run/nginx.pid;
events {
accept_mutex off;
use epoll;
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format combinedio '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" $request_length $request_time $upstream_response_time';
access_log logs/access.log combinedio;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
gzip on;
limit_req_zone $binary_remote_addr zone=one:10m rate=3r/s;
limit_req_zone $projectid zone=two:10m rate=3r/s;
limit_req_status 429;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location /server-status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
}
server {
listen 80;
server_name sentry.servername;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
location / {
proxy_pass http://127.0.0.1:9000;
}
location ~* /api/(?P<projectid>\d+/)?store/ {
proxy_pass http://127.0.0.1:9000;
limit_req zone=one burst=3 nodelay;
limit_req zone=two burst=10 nodelay;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment