if statement - Putting if else in nginx Vhost configuration with Puppet Nginx jfryman module -


I want to automate the nginx vhost configuration for a website, in which there are some conditional statements i with puppet power module It was trying to do this but I am not able to configure the file. I want the configuration to be given below:

  server {8080; Server_name abcqwe.com; root /data/vvv/abcqwe.com; Index index.php index.html index.htm; Access_log /data/vvv/abcqwe.com/logs/access.log; Error_log /data/vvv/abcqwe.com/logs/error.log; The first attempt to make the request as the location / {# file, then # directory, then go back to index.html #try_files $ uri $ uri / /index.html; If (! -f $ request_filename) {Set $ ​​rule_0 $ 1 rule_0; } try_files $ uri $ uri / /index.html; }   

So how do I put this condition inside my vhost configuration:

  if (! -f $ request_filename) {set $ rule_4 1 $ rule_4 ; }   

Is it possible to do this? I have tried with location_cfg_prepend , but it did not help.

I had the same problem with jfryman-nginx v0.0.9.

, It looks like if location_custom_cfg_ {pre, ap} pend is used then ; can not be added. > However, the template ; , even if in the line only } causes nginx to fail.

Solution:
  1. Use location _ ** custom ** _ cfg_ {east, ep} payout options

  2. Either A or B:

    A Edit out in template

    b. Drag the latest version of the source from Gitob:

    Pseudo RM-RF / etc / Puppet / Module / NGNX & amp; CD / etc / Puppet / module & amp; Amp; Sudo git clone nginx

    example
      nginx :: resource :: location {'sub.dom.com_root': make sure = & gt; Current, vhost = & gt; 'Sub.dom.com', location = & gt; '~ \ .php $', fastcgi = & gt; 'Unix: /var/run/php5-fpm.sock', www_root = & gt; '/var/www/sub.dom.com', location_custom_cfg_append = & gt; {'If (-f $ request_filename)' = & gt; '{ break; } ',' If (-d $ request_filename) '= & gt; '{ break; } ',' If ($ request_filename! ~ (Js | css | jpg | png | gif | robot \ .txt; index] .php. *)) '= & Gt; '{Rewrite ^ / (. *) /index.php?$1 final; } ',},}    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -