Skip to content

Instantly share code, notes, and snippets.

@eru123
Created November 29, 2023 01:16
Show Gist options
  • Save eru123/87d37c5558680acc354421653f2e2459 to your computer and use it in GitHub Desktop.
Save eru123/87d37c5558680acc354421653f2e2459 to your computer and use it in GitHub Desktop.
upstream uri_phpmyadmin { server phpmyadmin:80; }
upstream uri_skiddph_prod { server skiddph-prod:80; }
upstream uri_skiddph_dev { server skiddph-dev:80; }
upstream uri_skiddph_dev_main { server skiddph-dev:3000; }
upstream uri_skiddph_uat { server skiddph-uat:80; }
upstream uri_scholarship_gemma { server gemma-scholarship-dev:80; }
upstream uri_jmlumaday { server jmlumaday-dev:80; }
upstream uri_codehubph { server codehubph:3000; }
upstream uri_homepage { server homepage:3000; }
server {
listen 80;
listen [::]:80;
location / {
# Localhost
allow 127.0.0.1;
# Internal Homelab Router
allow 100.108.252.66;
# START MAGIC ALLOW IP
allow 174.138.189.46;
allow 172.17.0.1;
allow 172.20.0.1;
allow 172.23.0.1;
allow 2604:a00:21:4218:216:3eff:fe28:c692;
# END MAGIC ALLOW IP
deny all;
if ($host = 'skiddph.com') { proxy_pass http://uri_skiddph_prod; }
if ($host = 'codehubph.com') { proxy_pass http://uri_codehubph; }
if ($host = 'pma.skiddph.com') { proxy_pass http://uri_phpmyadmin; }
if ($host = 'skiddph-dev.skiddph.com') { proxy_pass http://uri_skiddph_dev; }
if ($host = 'skiddph-dev-main.skiddph.com') { proxy_pass http://uri_skiddph_dev_main; }
if ($host = 'skiddph-uat.skiddph.com') { proxy_pass http://uri_skiddph_uat; }
if ($host = 'scholarship-gemma.skiddph.com') { proxy_pass http://uri_scholarship_gemma; }
if ($host = 'jmlumaday.skiddph.com') { proxy_pass http://uri_jmlumaday; }
if ($host = 'homepage.skiddph.com') { proxy_pass http://uri_homepage; }
# Development
# if ($host = 'skiddph.com.local') { proxy_pass http://uri_skiddph_prod; }
# if ($host = 'skiddph-dev.skiddph.com.local') { proxy_pass http://uri_skiddph_dev; }
# if ($host = 'skiddph-dev-main.skiddph.com.local') { proxy_pass http://uri_skiddph_dev_main; }
# if ($host = 'skiddph-uat.skiddph.com.local') { proxy_pass http://uri_skiddph_uat; }
# if ($host = 'scholarship-gemma.skiddph.com.local') { proxy_pass http://uri_scholarship_gemma; }
# if ($host = 'jmlumaday.skiddph.com.local') { proxy_pass http://uri_jmlumaday; }
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
error_page 404 = @fallback;
}
location @fallback {
proxy_pass http://uri_skiddph_prod;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment