Welcome! Log In Create A New Profile

Advanced

Re: Emulate SSI 'exec cmd' with nginx

Maxim Dounin
April 23, 2013 10:24AM
Hello!

On Mon, Apr 22, 2013 at 06:45:55PM -0400, lpr wrote:

> 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?

There is no "exec" SSI command support in nginx.

In this particular case I would recommend using if with regular
expression and echo commands instead. Something like this should
work:

<!--# if expr="$request_uri = /(?P<foo>.+)/EN/(?P<bar>.+)" -->
<a href="<!--# echo var="foo" -->/GE/<!--# echo var="bar" -->">Deutsch</a>
<!--# endif -->

(Untested.)

--
Maxim Dounin
http://nginx.org/en/donation.html

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Emulate SSI 'exec cmd' with nginx

lpr April 22, 2013 06:45PM

Re: Emulate SSI 'exec cmd' with nginx

Maxim Dounin April 23, 2013 10:24AM

Re: Emulate SSI 'exec cmd' with nginx

lpr April 30, 2013 08:03AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 315
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready