• Server support is delivered by the Chevereto Community. As the server is a basic requirement, any server issue won't be considered for Chevereto Tech Support and it will be handled in this section.

Nginx location differences

DeCysos

Phoenix Foto Service
Beta tester
Nginx is still a mystery to me.

Could someone explain to me what the difference between ....
Code:
location ~* / {
    index index.php;
    try_files $uri $uri/ /index.php?$query_string;
}
and
Code:
location / {
    index index.php;
    try_files $uri $uri/ /index.php?$query_string;
}
consists ?

With my home server I have Plesk running as administration software and this software complains when I use location / {. It is quite complicated to use this method which is why I decided to use the following location ~* / {
Plesk complains because there is already an entry for "/".

Since I currently have no home server running without Plesk, I ask myself whether Nginx would complain if I made the change without Plesk and restart the Nginx service.

Would definitely be nice if someone could explain that to me. ;)
 

DeCysos

Phoenix Foto Service
Beta tester
i have found it.
https://mviess.de/sysadm/nginx.php
Original said:
1. location Block mit = Vorzeichen : Wenn die URI den String exakt trifft, verarbeitet NGINX diesen Block. (Beispiel : location = /doc)
2. location Block mit keinem Vorzeichen : Wenn die URI den String exakt trifft, verarbeitet NGINX diesen Block. (Beispiel : location /doc)
3. location Block mit ^~ Vorzeichen : Wenn die URI den beginn des Strings trifft, verarbeitet NGINX diesen Block UND STOPPT DIE SUCHE. (Beispiel : location ^~ /doc oder location ^~ /(abc|xyz))
4. location Block mit ~ oder ~* Vorzeichen : Wenn die URI den String mit REGEX trifft, verarbeitet NGINX diesen Block. (Beispiel : location ~ ^/doc$ oder location ~* ^/doc$)
Zu 4. Gibt es mehrere Blöcke mit ~ oder ~*, wird der Reihenfolge in der Konfiguration nach verarbeitet.
5. location Block mit keinem Vorzeichen : Wenn die URI den beginn des Strings trifft, verarbeitet NGINX diesen Block. (Beispiel : location /doc)
Zu 5. Hier trifft der längere Treffer. Haben wir location mit /doc und /document und der Request ist /documents.html wird der /document Block verarbeitet.
1. location block with = sign: If the URI matches the string exactly, NGINX processes this block. (Example: location = /doc)
2. Location block with no sign: If the URI matches the string exactly, NGINX processes this block. (Example: location /doc)
3. location block with ^~ sign: If the URI hits the beginning of the string, NGINX processes this block AND STOPS THE SEARCH. (Example: location ^~ /doc or location ^~/(abc|xyz))
4. location block with ~ or ~* sign: If the URI hits the string with REGEX, NGINX processes this block. (Example: location ~^ /doc$ or location ~* ^ /doc$)
Re 4. If there are several blocks with ~ or ~*, the order in the configuration is processed.
5. Location block with no sign: If the URI hits the beginning of the string, NGINX processes this block. (Example: location /doc)
To 5. The longer hit hits here. If we have location with /doc and /document and the request is /documents.html the /document block is processed.
 
Top