nginxssi

nginx SSI call - how to execute a script via proxy pass?


I'm trying to work out how to get this going in my HTML page:

<!--# exec cgi="/cgi-bin/links/track_ssi.cgi" -->

I see this in the log file:

invalid SSI command: "exec" while sending response to client

We have a proxy pass from nginx to Apache2.4:

    location ~ \.cgi$ {
        gzip off;
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:8181;
    }

As far as I can see though, its not even getting that far. What am I doing wrong?

Thanks!


Solution

  • There is no exec cgi SSI command, please see Nginx documentation on SSI.

    Correct SSI fragment will be

    <!--#include virtual="/cgi-bin/links/track_ssi.cgi" -->
    

    (assuming everything else is correctly configured)