mirror of
https://github.com/Redume/Kekkai.git
synced 2025-02-23 20:51:25 +03:00
feat: Made rate limit via nginx
Some checks are pending
Create and publish a Docker image / build-and-push-server (push) Waiting to run
Create and publish a Docker image / build-and-push-chart (push) Waiting to run
Create and publish a Docker image / build-and-push-CR (push) Waiting to run
Deploy docs / deploy (push) Waiting to run
Some checks are pending
Create and publish a Docker image / build-and-push-server (push) Waiting to run
Create and publish a Docker image / build-and-push-chart (push) Waiting to run
Create and publish a Docker image / build-and-push-CR (push) Waiting to run
Deploy docs / deploy (push) Waiting to run
This commit is contained in:
parent
bb0c22bb1d
commit
29f185adcf
1 changed files with 22 additions and 0 deletions
22
nginx.conf
22
nginx.conf
|
@ -1,6 +1,9 @@
|
||||||
events { }
|
events { }
|
||||||
|
|
||||||
http {
|
http {
|
||||||
|
limit_req_zone $binary_remote_addr zone=kekkai:10m rate=10r/s;
|
||||||
|
# Change the number '10' to your own, to change the threshold number for rate limit
|
||||||
|
|
||||||
upstream server_backend {
|
upstream server_backend {
|
||||||
server server:3000;
|
server server:3000;
|
||||||
}
|
}
|
||||||
|
@ -13,8 +16,11 @@ http {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name localhost; # Your domain
|
server_name localhost; # Your domain
|
||||||
|
|
||||||
|
limit_req zone=kekkai;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
|
limit_req zone=kekkai burst=4;
|
||||||
|
|
||||||
proxy_pass http://server_backend;
|
proxy_pass http://server_backend;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
@ -23,6 +29,8 @@ http {
|
||||||
}
|
}
|
||||||
|
|
||||||
location /api/configuration {
|
location /api/configuration {
|
||||||
|
limit_req zone=kekkai burst=4;
|
||||||
|
|
||||||
proxy_pass http://server_backend;
|
proxy_pass http://server_backend;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
@ -31,6 +39,8 @@ http {
|
||||||
}
|
}
|
||||||
|
|
||||||
location /api/getChart {
|
location /api/getChart {
|
||||||
|
limit_req zone=kekkai burst=4;
|
||||||
|
|
||||||
proxy_pass http://chart_backend;
|
proxy_pass http://chart_backend;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
@ -39,6 +49,8 @@ http {
|
||||||
}
|
}
|
||||||
|
|
||||||
location /static/chart {
|
location /static/chart {
|
||||||
|
limit_req zone=kekkai burst=4;
|
||||||
|
|
||||||
proxy_pass http://chart_backend;
|
proxy_pass http://chart_backend;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
@ -54,7 +66,11 @@ http {
|
||||||
ssl_certificate /etc/nginx/ssl/fullchain.pem;
|
ssl_certificate /etc/nginx/ssl/fullchain.pem;
|
||||||
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
|
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
|
||||||
|
|
||||||
|
limit_req zone=kekkai;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
|
limit_req zone=kekkai burst=4;
|
||||||
|
|
||||||
proxy_pass http://server_backend;
|
proxy_pass http://server_backend;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
@ -63,6 +79,8 @@ http {
|
||||||
}
|
}
|
||||||
|
|
||||||
location /api/configuration {
|
location /api/configuration {
|
||||||
|
limit_req zone=kekkai burst=4;
|
||||||
|
|
||||||
proxy_pass http://server_backend;
|
proxy_pass http://server_backend;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
@ -71,6 +89,8 @@ http {
|
||||||
}
|
}
|
||||||
|
|
||||||
location /api/getChart {
|
location /api/getChart {
|
||||||
|
limit_req zone=kekkai burst=4;
|
||||||
|
|
||||||
proxy_pass http://chart_backend;
|
proxy_pass http://chart_backend;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
@ -79,6 +99,8 @@ http {
|
||||||
}
|
}
|
||||||
|
|
||||||
location /static/chart {
|
location /static/chart {
|
||||||
|
limit_req zone=kekkai burst=4;
|
||||||
|
|
||||||
proxy_pass http://chart_backend;
|
proxy_pass http://chart_backend;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue