
events{
    worker_connections 1024;
}

http{
 upstream client{
         server client:8083;
 }

 upstream server{
         server api:8084;
 }

server {
    listen 80;

    server_name computo.fismat.umich.mx;

    #la logica del frontend esta en /
    location / {
        root /usr/share/nginx/html;
        index index.html;
        try_files $uri $uri/ /index.html;
    }

    #la logica del backend esta en /api
    location /api {
        proxy_pass http://api:8084;
        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;
    }

    #Esto seria para el url computo.fismat.umich.mx/livequiz (teoricamente)#
#    location /livequiz {
#        rewrite ^/livequiz(.*) /$1 break;
#        proxy_pass http://computo.fismat.umich.mx:8083;
#        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;
#    }

    location /livequiz {
    alias /usr/share/nginx/html;
    try_files $uri $uri/ index.html;
}

}

}