T
T
Twelfth Doctor2017-09-28 18:56:52
Python
Twelfth Doctor, 2017-09-28 18:56:52

Where is the error in Jinja 2 template?

Hello. Tell me, where is the error in the Jinja 2 template?

server {
        listen   80; 
        {{ssl}}
charset {{vhost.charset}};
        root /home/u{{vhost.userid}}/web/{{vhost.mainname}}; 
        index {{vhost.index}};
        {% if aliases is defined %}
        server_name {{vhost.mainname}} www.{{vhost.mainname}} {{aliases}}; 
        {% else %}
        server_name {{vhost.mainname}} www.{{vhost.mainname}}; 
        {% endif %}
{% if errorpages.len() >0 %}
{% for page in errorpages %}
error_page {{page.type}} {{page.url}}
{% endfor % }
{% endif %}
{% if redirects.len() >0 %}
{% for item in redirects %}
location = {{item.from}} {
                 return {{item.type}} {{item.to}} 
                 }
{% endfor % }
{% endif%}
        location / {
        try_files \$uri \$uri/ /{{;
        }
         location ~ /\.ht {
                deny all;
        }
        {% if mode=='nginx %}
         location ~ \.php$ {
          try_files \$uri /index.php =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php{{php}}-{{siteuser}};
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
        include fastcgi_params;
         }
         {% elif mode=='apache' %}
         location ~ \.php$ {

        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:81;

         }
         location ~ /\.ht {
                deny all;
        }
         {% endif %}
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2017-09-28
@fox_12

this looks a little crooked:
it should be something like
{% if errorpages|length >0 %}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question