-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
deen john
authored and
deen john
committed
Sep 22, 2024
1 parent
8f1bfeb
commit a19dc45
Showing
7 changed files
with
101 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-----BEGIN PRIVATE KEY----- | ||
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDCP0nB4wauqFMt | ||
+KLKJUoeCvr9R326jjLTniF1iiytBPveQOxdOigwCL7xpw6TnYbxK91gMNRd+9DD | ||
zWM19iOOmds5nKX/Wv/siNDz6V2i1w1hrVr9Mn/K4Td0zpLhhYRP2tHW65vI1tVv | ||
CvGJBCfc74MM5SwIylqB7xDEs1rfE04SP1/1whNDK6eU+jpPbBxqcjtjeyzFAI7B | ||
vyqVT9IcDUqlpD1uXc4HXAuBzkaWHiCEk2tDPoy2U80tGgJ6CahTSOP5HjxnI999 | ||
smKPp6lYs367xkQ9arOzNNMLcfqedXIuQ6J/nK5iLkM3JqsTsqC33TWi8SOEP+3R | ||
FBjE1kWzAgMBAAECggEAderFc5XFsLEuDXIqIFySqbowsyB7CozX/e64kQnYJRAp | ||
dbojwlRToRUuFLQ8/Q9bo3vlX0dFI+iBytsbpt5Mp3xuwIJ/oowzX/uOHQNFfFzg | ||
GrOJ0LqfKSGe8KGWOKE8uN01FSrh3wHLfyU9itei+1PKUkGsgYmVd9sQatgWCeQ3 | ||
XdR1hmZ87S7knjeH5lfYDBLOgMbgNE5FbNCXWNVLuOIEdGfjFUmWquV7ejpz64U0 | ||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contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIEUjCCArqgAwIBAgIQMu4krDIxPqfHWxF7yUbz/jANBgkqhkiG9w0BAQsFADCB | ||
jTEeMBwGA1UEChMVbWtjZXJ0IGRldmVsb3BtZW50IENBMTEwLwYDVQQLDChqb2hu | ||
QGRlZW5zLU1hY0Jvb2stUHJvLmxvY2FsIChkZWVuIGpvaG4pMTgwNgYDVQQDDC9t | ||
a2NlcnQgam9obkBkZWVucy1NYWNCb29rLVByby5sb2NhbCAoZGVlbiBqb2huKTAe | ||
Fw0yNDA5MjIxODQ0NDhaFw0yNjEyMjIxODQ0NDhaMFwxJzAlBgNVBAoTHm1rY2Vy | ||
dCBkZXZlbG9wbWVudCBjZXJ0aWZpY2F0ZTExMC8GA1UECwwoam9obkBkZWVucy1N | ||
YWNCb29rLVByby5sb2NhbCAoZGVlbiBqb2huKTCCASIwDQYJKoZIhvcNAQEBBQAD | ||
ggEPADCCAQoCggEBAMI/ScHjBq6oUy34osolSh4K+v1HfbqOMtOeIXWKLK0E+95A | ||
7F06KDAIvvGnDpOdhvEr3WAw1F370MPNYzX2I46Z2zmcpf9a/+yI0PPpXaLXDWGt | ||
Wv0yf8rhN3TOkuGFhE/a0dbrm8jW1W8K8YkEJ9zvgwzlLAjKWoHvEMSzWt8TThI/ | ||
X/XCE0Mrp5T6Ok9sHGpyO2N7LMUAjsG/KpVP0hwNSqWkPW5dzgdcC4HORpYeIIST | ||
a0M+jLZTzS0aAnoJqFNI4/kePGcj332yYo+nqVizfrvGRD1qs7M00wtx+p51ci5D | ||
on+crmIuQzcmqxOyoLfdNaLxI4Q/7dEUGMTWRbMCAwEAAaNeMFwwDgYDVR0PAQH/ | ||
BAQDAgWgMBMGA1UdJQQMMAoGCCsGAQUFBwMBMB8GA1UdIwQYMBaAFLBiiVNNNmNq | ||
NT9ofkD3/FJQFl/vMBQGA1UdEQQNMAuCCWxvY2FsaG9zdDANBgkqhkiG9w0BAQsF | ||
AAOCAYEAFEzpfUY6bsN0QZ3Jfa5qriOyo/Vrcy3aaozbAm7yv0sTBx1XL1NdpCT8 | ||
I9oLhTmwrwj+DaCaAUV/cWj0kDS4KEJhOzkgHLzAu2r6mqlGLjdCFTJuUItOw/Bz | ||
zy+JRBbNOyCjbTDPW3TKU12lqmSEjWhbqXgn/mLwwgBGYjsrybkV7DXf+KbI+LvG | ||
PjIXq3q1px+nz0eYozVKW42HgVaEEUdmMZ0Wqng/K8b3Bg9K3BZcMWHdVEOUpyeL | ||
m4SizY5FyMeeVwJVx62UrkT+5fuCFWuVk96U2fduy9mqhisMOGESntHER3gRAAi/ | ||
/IDGqOMEtEHr63Ffe5DUPetuN/oavswgJpno7QAK9NlaRGUunCKViRxp+/D+CHU3 | ||
AwuLhmjFPz0pkcd8mjkNKaeXGR9MfRz4lsSoto+xPVC6pALkDEd4lRUbQ4YRH3dx | ||
tH0RN8ciXAiuFdflaHKHmCOdiC7pQXA0JRUfnOoxzw6tW8i1tK6duO1ENH8B1CPr | ||
4A5a++55 | ||
-----END CERTIFICATE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,46 @@ | ||
events { | ||
worker_connections 1024; | ||
worker_connections 1024; | ||
} | ||
|
||
# round robin algo | ||
# http { | ||
# upstream backend_servers { | ||
# server servera:4000; | ||
# # You can uncomment these lines when needed | ||
# server serverb:5000; | ||
# server serverc:4200; | ||
# } | ||
http { | ||
upstream backend_servers { | ||
server servera:4000; | ||
server serverb:5000 weight=5; | ||
server serverc:4200 backup; | ||
} | ||
server { | ||
listen 80; | ||
|
||
# Route all /api/ requests to the upstream servers | ||
location /users/ { | ||
proxy_pass http://backend_servers; # Proxy to the upstream group | ||
proxy_http_version 1.1; # Ensure HTTP 1.1 for things like keep-alive and WebSockets | ||
proxy_set_header Connection ""; # Forward the connection header for keep-alive | ||
|
||
# Forward client details to backend | ||
proxy_set_header Host $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_cache_path /nginx_cache levels=1:2 keys_zone=my_cache:10m max_size=50m inactive=60m use_temp_path=off; | ||
log_format customz `$request $upstream_cache_status`; | ||
upstream backend_servers { | ||
server servera:4000; | ||
server serverb:5000 weight=5; | ||
server serverc:4200 backup; | ||
} | ||
server { | ||
listen 80; | ||
listen 443 ssl; | ||
ssl_certificate /certs/cert.pem; | ||
ssl_certificate_key /certs/key.pem; | ||
|
||
# Route all /api/ requests to the upstream servers | ||
location /users/ { | ||
proxy_pass http://backend_servers; # Proxy to the upstream group | ||
proxy_http_version 1.1; # Ensure HTTP 1.1 for things like keep-alive and WebSockets | ||
proxy_set_header Connection ""; # Forward the connection header for keep-alive | ||
|
||
# Forward client details to backend | ||
proxy_set_header Host $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; | ||
|
||
# Enable caching | ||
proxy_cache my_cache; # Use the defined cache zone | ||
proxy_cache_valid 200 302 304 10m; # Cache 200 and 302 responses for 10 minutes | ||
proxy_cache_valid 404 1m; # Cache 404 responses for 1 minute | ||
proxy_cache_min_uses 1; # Cache after 1 use | ||
add_header X-Cache-Status $upstream_cache_status; # Add cache status in response header | ||
} | ||
|
||
# Optional: Serve a simple index page at the root if needed | ||
location / { | ||
return 200 "Welcome to Nginx proxy server.\n"; | ||
add_header Content-Type text/plain; | ||
# Serve a simple index page at the root | ||
location / { | ||
return 200 "Welcome to Nginx proxy server.\n"; | ||
add_header Content-Type text/plain; | ||
} | ||
} | ||
} | ||
} |