Skip to content
Foxipa
Code Completion 5 Challenges

Complete the config: Nginx Proxy & Gateway

Fill in proxy_pass, forwarding headers, WebSocket upgrades, and FastCGI wiring.

Intermediate ~4 min read

Challenge 1

Forward the full original URI to the backend pool.

nginx Your answer
location / {
     http://backend;
}

Press Ctrl⌘Enter to check your answer

Challenge 2

Tell the backend the client address NGINX sees.

nginx Your answer
location / {
    proxy_pass http://backend;
    proxy_set_header  $remote_addr;
}

Press Ctrl⌘Enter to check your answer

Challenge 3

Forward the client's upgrade intent.

nginx Your answer
proxy_set_header  $http_upgrade;
proxy_set_header Connection $connection_upgrade;

Press Ctrl⌘Enter to check your answer

Challenge 4

Tell PHP-FPM which script to execute.

nginx Your answer
location ~ \.php$ {
    fastcgi_pass unix:/run/php/php-fpm.sock;
    fastcgi_param  $document_root$fastcgi_script_name;
}

Press Ctrl⌘Enter to check your answer

Challenge 5

Enable keep-alive connections to the upstream.

nginx Your answer
upstream backend { server 10.0.0.10:8080; keepalive 32; }
location / {
     1.1;
    proxy_set_header Connection "";
    proxy_pass http://backend;
}

Press Ctrl⌘Enter to check your answer