Skip to content

Instantly share code, notes, and snippets.

@markotom
Created August 7, 2019 05:05
Show Gist options
  • Save markotom/cdbf300b132d8bcdb2eb00915dba3188 to your computer and use it in GitHub Desktop.
Save markotom/cdbf300b132d8bcdb2eb00915dba3188 to your computer and use it in GitHub Desktop.
upstream apiServer {
server localhost:3000;
}
upstream appServer {
server localhost:4000;
}
upstream adminServer {
server localhost:4050;
}
upstream apiModelsServer {
server localhost:5005;
}
server {
server_name intercambiosoceanicos.iib.unam.mx; # managed by Certbot
root /usr/share/nginx/html;
access_log /var/log/nginx/oceanicex.access.log;
error_log /var/log/nginx/oceanicex.error.log;
location / {
index index.html;
}
location /api {
client_max_body_size 0;
proxy_pass http://apiServer;
proxy_redirect off;
proxy_read_timeout 5m;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
}
location /admin {
client_max_body_size 0;
proxy_pass http://adminServer;
proxy_redirect off;
proxy_read_timeout 5m;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
}
location /app {
client_max_body_size 0;
proxy_pass http://appServer;
proxy_redirect off;
proxy_read_timeout 5m;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
}
location /api-models {
client_max_body_size 0;
proxy_pass http://apiModelsServer;
proxy_redirect off;
proxy_read_timeout 5m;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/intercambiosoceanicos.iib.unam.mx/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/intercambiosoceanicos.iib.unam.mx/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = intercambiosoceanicos.iib.unam.mx) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 ;
server_name intercambiosoceanicos.iib.unam.mx;
return 404; # managed by Certbot
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment