server {

    # Configuracion de https
    server_name *.saitsync.com;
    listen [::]:443 ssl;
    listen 443 ssl;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;


    # Backend sera servido por el puerto 8001 por php
    location /sync/api/v2 {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME /home/sait-sync/api/public/index.php;
        fastcgi_param SCRIPT_NAME     /index.php;
        fastcgi_pass  127.0.0.1:8001;
    }


    # Frontend sera servido en puerto 8000 por nginx
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://127.0.0.1:8000;
    }

}



# Configuracion para http
server {

    listen 80 ;
    listen [::]:80 ;
    server_name *.saitsync.com;
    return 404;

}
