Complete the code to define a location block that matches requests to the root URL.
location [1] {
proxy_pass http://backend;
}The / location matches the root URL path, routing requests to the backend.
Complete the code to match requests starting with /images/ using a prefix location.
location [1] {
root /var/www/images;
}The prefix /images/ matches all requests starting with that path.
Fix the error in the regex location that matches .php files.
location [1] {
fastcgi_pass unix:/var/run/php.sock;
}~* which is case-insensitive and may not be desired.The ~ prefix defines a case-sensitive regex match for .php files.
Fill both blanks to create a location block that matches requests starting with /api/ and disables regex matching.
location [1] [2] { proxy_pass http://api_backend; }
The ^~ prefix tells nginx to match the prefix /api/ and skip regex checks.
Fill the two blanks to define a location block that matches exactly /status and returns 200 with a message.
location [1] /status { return [2] 'OK'; }
The = prefix matches the exact URI /status, which has the highest priority and skips regex locations. return 200 'OK'; sends a success response.