Created
July 25, 2025 20:39
-
-
Save diegofcornejo/2ba58e426e9083bac1cd3ab3ad066f5a to your computer and use it in GitHub Desktop.
ChirpStack NGINX conf
This file contains hidden or 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
server { | |
server_name lorawan-ns-02.diegocornejo.com; | |
listen 80; | |
# --- API --- | |
location ^~ /api/ { | |
proxy_pass http://127.0.0.1:8090; | |
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_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection $http_connection; | |
proxy_redirect off; | |
proxy_read_timeout 300s; | |
proxy_send_timeout 300s; | |
} | |
# --- APP (8080) --- | |
location / { | |
proxy_pass http://127.0.0.1:8080; | |
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_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection $http_connection; | |
proxy_redirect off; | |
} | |
# --- DOCS --- | |
location = /api/docs { return 308 /api/docs/; } | |
location ^~ /api/docs/ { | |
proxy_pass http://127.0.0.1:8090/; # con slash: strip /api/docs/ | |
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_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection $http_connection; | |
proxy_redirect off; | |
} | |
location = /api/docs/api.json { | |
proxy_pass http://127.0.0.1:8090/api.json; | |
proxy_hide_header Cache-Control; | |
add_header Cache-Control "public, max-age=300, immutable" always; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment