robosats-deploy/k8s/base/nginx/configmap.yml
Reckless_Satoshi a069f98a1a init
2023-09-29 05:10:16 -07:00

86 lines
2.4 KiB
YAML

apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-configmap
data:
local.conf: |
limit_req_zone $binary_remote_addr zone=limitonesec:10m rate=1r/s;
#first we declare our upstream server, which is our Gunicorn application
upstream robosats_gunicorn_rest {
# kubernetes will automatically resolve this to the correct address
server gunicorn:8000;
}
upstream robosats_daphne_websocket {
# kubernetes will automatically resolve this to the correct address
server daphne:9000;
}
# now we declare our main server
server {
listen 80;
server_name testnet.robosats.com;
location /static {
alias /usr/src/static;
}
location /.well-known {
alias /usr/src/.well-known;
}
location / {
# requests are passed to Gunicorn
proxy_pass http://robosats_gunicorn_rest;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
# Edit for your own onion service
add_header Onion-Location http://robotestagw3dcxmd66r4rgksb4nmmr43fh77bzn2ia2eucduyeafnyd.onion$request_uri;
}
location /ws/ {
# websockets are passed to Daphne
proxy_pass http://robosats_daphne_websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}
location = /favicon.ico { access_log off; log_not_found off; }
}
nginx.conf: |
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/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" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/local.conf;
}