Answer the question
In order to leave comments, you need to log in
Nginx, SSI and using variables
I use SSI in Nginx and love it. But there's a problem.
<!--# set var="title" value="blah blah" --> <img src="bla-bla.jpg" />
<!-- HTML comment <!--# include virtual="/random/?$args" wait="yes" --> --> <head> <title><!--# echo var="title" encoding="none" default="no title" --></title> </head> <body> .... <!--# include virtual="/random/?$args" --> </body>
<!-- HTML comment <!--# include virtual="/random/?$args" wait="yes" set="random_html" --> --> <head> <title><!--# echo var="title" encoding="none" default="no title" --></title> </head> <body> .... <!--# echo var="random_html" encoding="none" default="" --> </body>
Answer the question
In order to leave comments, you need to log in
Your variant with two variables in my opinion is the only possible one.
But to store large chunks of text in SSI variables, you need to use the undocumented ssi_value_length directive, which is 256 bytes by default, and this is most likely not enough to store your html code (there should be messages about this in the error log):
location /random/ { ... ssi_value_length 32k; }
there in nginx in ssi there is a parameter that allows you to assign the result of include to a variable. do this at the beginning of the page, get a variable with the image code and change it with the title. insert them where necessary in the page and it's done
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question