• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question NGINX Directives Location question

Noise

New Pleskian
Hi all

what is the different between these locations such:

Code:
location ~ /.
location ~* \.
location ~ /\.
location = /


which one is the right one to use in Additional nginx directives per domain ?
i'm a little confused about this an i'm very new to nginx

thx
 
Well there are a lot of documentation and explanation around for nginx directives like:
https://www.scalescale.com/tips/nginx/nginx-location-directive
Nginx Location Directive Explained - KeyCDN Support
Module ngx_http_core_module

so start read them...
  • =: The equal sign can be used if the location needs to match the exact request URI. When this modifier is matched, the search stops right here.
  • ~: Tilde means that this location will be interpreted as a case-sensitive RE match.
  • ~*: Tilde followed by an asterisk modifier means that the location will be processed as a case-insensitive RE match.
  • ^~: Assuming this block is the best non-RE match, a carat followed by a tilde modifier means that RE matching will not take place.
 
ok thx i read so much and my head is smoking now :D

i post a thread about my directives in the wrong section i do a new thread next time because i change many things.

one question i have here again

what is the different between this:

Code:
location ~* .(png|gif|ico|jpg|jpeg)$ {
  # Matches requests ending in png, gif, ico, jpg or jpeg.
  # Any request to the /img/ directory are handled by the location block above.
}

and this:
Code:
location ~* .(?:png|gif|ico|jpg|jpeg)$ {
}

i search a directive who takes me javascript with .js? like this:
Code:
/media/widgetkit/widgets/spotlight/js/spotlight.js?wkv=1.4.9

to add Expires headers
 
Please describe a bit more in detail, what do you like to achive and quote your complete directives and how did you test/see that it is not working, perhabs then community can help
 
Back
Top