• We value your experience with Plesk during 2026
    Please help us understand which Plesk features made your work easier this year, what is still missing and how AI should help you in Plesk ?
    Take this short 5-minutes survey. Your answers go straight into the Plesk roadmap for 2027.

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