0
0
Nginxdevops~10 mins

Why reverse proxying serves backend applications in Nginx - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define the server listening on port 80.

Nginx
server {
    listen [1];
    server_name example.com;
}
Drag options to blanks, or click blank then click option'
A80
B443
C22
D8080
Attempts:
3 left
💡 Hint
Common Mistakes
Using port 443 without SSL configuration
Using SSH port 22 instead of HTTP port
2fill in blank
medium

Complete the code to forward requests to the backend server at localhost port 3000.

Nginx
location / {
    proxy_pass http://[1];
}
Drag options to blanks, or click blank then click option'
A127.0.0.1:80
Blocalhost:22
C127.0.0.1:3000
D192.168.1.1:3000
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong port number
Using external IP instead of localhost
3fill in blank
hard

Fix the error in the proxy_pass directive to correctly forward to backend.

Nginx
location /api/ {
    proxy_pass http://127.0.0.1[1]3000/;
}
Drag options to blanks, or click blank then click option'
A.
B/
C;
D:
Attempts:
3 left
💡 Hint
Common Mistakes
Using slash instead of colon between IP and port
Omitting the port separator
4fill in blank
hard

Fill both blanks to set headers that preserve the original client IP and host.

Nginx
location / {
    proxy_set_header [1] $remote_addr;
    proxy_set_header [2] $host;
}
Drag options to blanks, or click blank then click option'
AX-Real-IP
BHost
CX-Forwarded-For
DServer-Name
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect header names
Not setting headers to preserve client info
5fill in blank
hard

Fill both blanks to create a reverse proxy that listens on port 80, forwards to backend at 5000, and sets the correct headers.

Nginx
server {
    listen [1];
    location / {
        proxy_pass http://127.0.0.1:5000;
        proxy_set_header [2] $remote_addr;
    }
}
Drag options to blanks, or click blank then click option'
A80
B:
CX-Real-IP
D443
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong port in listen directive
Missing colon between IP and port
Not setting client IP header