Emulate SSI 'exec cmd' with nginx

lpr nginx-forum at nginx.us
Mon Apr 22 22:45:55 UTC 2013

Dear all

Trying to move my pages from Apache to nginx (1.2.1 on Debian stable with
backports), I run into the problem of having used SSI's 'exec cmd' for more
than a decade quite intensively.

What is the best and easiest way to emulate 'exec cmd' with nginx?

For example, in my footers I make use of dynamically change between ENglish
and GErman with a shell script as easy as

<!--# exec cmd="setlanguage.sh" -->

with setlanguage.sh as

echo "<a href=\"$(echo $REQUEST_URI | sed -e 's:/EN/:/GE/:')\">Deutsch</a>"

When I try using <!--# include virtual="setlanguage.sh" -->, the script is
executed.  However, instead of just adding the link, nginx includes the
German web-page fully.

Is there an easy way to get the same functionality with nginx?

Thanks for any hint.

Best regards

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,238561,238561#msg-238561

More information about the nginx mailing list