ansible-role-nginx-config
ansible-role-nginx-config copied to clipboard
Nested location
Hello! I have the impression that it is not possible to have a nested location directive within a location directive. Is this a planned feature? Thanks :)
It's not planned at this time. That being said, you should be able to define some by using the custom_directives parameter https://github.com/nginxinc/ansible-role-nginx-config/blob/main/templates/http/default.conf.j2#L427-L435 😄
It would be nice to be able to combine things like authentication and php. The proposed way with custon_directives is working but definitely it is ugly hackish approach ;-)
...
- location: ~ /foto/
auth_basic:
realm: "'Please log in.'"
user_file: $document_root/foto/.htpasswd
custom_directives:
- "location ~ \\.php {"
- " include snippets/fastcgi-php.conf;"
- " fastcgi_pass unix:/run/php/php-fpm.sock;"
- "}"