Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested location #347

Open
GaetanJourdan opened this issue Jul 6, 2023 · 2 comments
Open

Nested location #347

GaetanJourdan opened this issue Jul 6, 2023 · 2 comments
Labels
enhancement Enhance an existing feature needs validation Requires further validation

Comments

@GaetanJourdan
Copy link

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 :)

@alessfg
Copy link
Collaborator

alessfg commented Jul 6, 2023

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 😄

@alessfg alessfg added enhancement Enhance an existing feature needs validation Requires further validation labels Jul 6, 2023
@gimli2
Copy link

gimli2 commented Jun 19, 2024

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;"
    - "}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhance an existing feature needs validation Requires further validation
Projects
Development

No branches or pull requests

3 participants