nginx-default-conf

Generate nginx.default.conf with SPA routing and caching directives.

Updated Jan 15, 2026
One-click install
npx skills add https://github.com/KaiserWhoLearns/skillsbench --skill nginx-default-conf-kaiserwholearns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nginx-default-conf
Source: https://github.com/KaiserWhoLearns/skillsbench/tree/main/registry/terminal_bench_2.0/terminal_bench_2_0_nginx-request-logging/environment/skills/nginx-default-conf
Command: npx skills add https://github.com/KaiserWhoLearns/skillsbench --skill nginx-default-conf-kaiserwholearns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Generates a ready-to-use nginx.default.conf for the conf.d directory to configure static file serving and SPA routing for modern single-page apps.

Core Features & Use Cases

  • Generates a concise nginx default configuration tailored for serving static assets from /usr/share/nginx/html and enabling SPA routing with a try_files fallback to index.html.
  • Includes caching directives, optional health check or error-page patterns, and CORS headers suitable for development and micro-frontend deployments.
  • Ideal for Dockerized deployments where the produced file is copied into /etc/nginx/conf.d/default.conf as part of the image build.

Quick Start

Generate the nginx.default.conf to configure a SPA-ready nginx conf.d setup for containerized deployments.

Frequently Asked Questions about nginx-default-conf

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure nginx for SPA routing in a Docker container?

You configure SPA routing by placing a generated nginx.default.conf in the conf.d directory to serve static assets and use try_files to fallback requests to index.html.

What is the best way to serve a single-page application with nginx try_files?

The best way to serve a single-page application with nginx is using the try_files directive to fallback to index.html for client-side routing. This setup also includes caching directives and CORS headers for static assets.

Can I add CORS headers and caching directives to my nginx static file server?

Yes, you can add CORS headers and caching directives to your nginx static file server. This configuration generates a template that includes these settings by default, making it suitable for development and micro-frontend deployments.

Does this nginx configuration support health check endpoints and custom error pages?

Yes, the nginx configuration supports optional health check endpoints and custom error-page patterns. These settings are generated as part of the template to help you monitor application availability and handle routing failures gracefully.

Why does my SPA return 404 errors when I refresh the page in nginx?

Your SPA returns 404 errors on refresh because nginx cannot find static files matching client-side routes. You need a try_files configuration that falls back to index.html to resolve unknown paths within your single-page application.