I'd like to use this rule in Nginx config file :
location @rewriteapp {
# rewrite all to app.php
rewrite ^(.*)$ /app.php/$1 last;
}
(this rule is used for Symfony framework). I used puphpet site to generate vagrant files and I modified default.pp to change the configuration of Nginx Vhost I add something like that to create this rewrite rule :
nginx::resource::location { "${server_name}-rewrite":
location => '@rewriteapp',
www_root => $www_root,
proxy => undef,
rewrite => '^(.*)$ /app.php/$1 last;'
}
But I get the following error : Invalid parameter rewrite at /tmp/vagrant-puppet-1/manifests/default.pp:267 on node packer-virtualbox.vagrantup.com
Is there a way to add rewrite rule to Nginx vhost config with Puppet ?
The problem is that rewrite is not a valid option in the nginx puppet module.
You need to use either location_cfg_append
or location_custom_cfg
I dont have puppet setup at the moment to test but I think the syntax you need will be something like this:
nginx::resource::location { "${server_name}-rewrite":
location => '@rewriteapp',
www_root => $www_root,
proxy => undef,
location_cfg_append => {
'rewrite' => '^(.*)$ /app.php/$1 last;'
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.