Skip to content
Foxipa
Code Completion 5 Challenges

Complete the config: Nginx Static Content

Fill in root, alias, try_files, MIME, and error-page directives.

Beginner ~4 min read

Challenge 1

Map /img/ requests onto /data/pictures/ with the prefix stripped.

nginx Your answer
location /img/ {
     /data/pictures/;
}

Press Ctrl⌘Enter to check your answer

Challenge 2

Complete the SPA fallback: real file, then directory, then the app shell.

nginx Your answer
location / {
    root /app;
    try_files $uri $uri/ ;
}

Press Ctrl⌘Enter to check your answer

Challenge 3

Serve unknown extensions as a download instead of text.

nginx Your answer
server {
     application/octet-stream;
}

Press Ctrl⌘Enter to check your answer

Challenge 4

Serve the branded 404 page.

nginx Your answer
server {
     404 /404.html;
}

Press Ctrl⌘Enter to check your answer

Challenge 5

Let the kernel copy file bytes straight to the socket.

nginx Your answer
server {
     on;
    tcp_nopush on;
}

Press Ctrl⌘Enter to check your answer