Skip to content

fix(nginx plugin): place mime.types next to nginx.conf so include resolves#2929

Open
mikeland73 wants to merge 1 commit into
mainfrom
claude/focused-goldberg-umv184
Open

fix(nginx plugin): place mime.types next to nginx.conf so include resolves#2929
mikeland73 wants to merge 1 commit into
mainfrom
claude/focused-goldberg-umv184

Conversation

@mikeland73

Copy link
Copy Markdown
Collaborator

Summary

Fixes #2908.

The nginx plugin currently fails to start because it cannot find its mime.types file:

[emerg] open() ".../devbox.d/nginx/mime.types" failed (2: No such file or directory) in .../devbox.d/nginx/nginx.conf:6

Root cause: PR #2844 added include mime.types; to nginx.conf and created the mime.types file at {{ .Virtenv }}/mime.types (.devbox/virtenv/nginx/mime.types), under the assumption that nginx -p $NGINX_PATH_PREFIX would make the relative include resolve against the prefix path. In fact nginx only uses the -p prefix for runtime paths (error_log, access_log, root, …); at configuration time, relative include paths are resolved relative to the nginx.conf file itself, which devbox places in the DevboxDir (devbox.d/nginx/).

Fix: Create mime.types in the DevboxDir alongside nginx.conf, so the relative include mime.types; resolves correctly. This mirrors how the plugin already handles fastcgi.conf (also created in DevboxDir). The plugin version is bumped 0.0.50.0.6 so existing environments pick up the relocated file.

-    "{{ .Virtenv }}/mime.types": "nginx/mime.types",
+    "{{ .DevboxDir }}/mime.types": "nginx/mime.types",

How was it tested?

  • Verified plugins/nginx.json remains valid JSON.
  • Traced the file-placement logic: nginx.conf is created at {{ .DevboxDir }}/nginx.conf and uses a relative include mime.types;; placing mime.types in the same DevboxDir makes the include resolvable. The fastcgi.conf file already follows this exact placement pattern.
  • No other references to the {{ .Virtenv }}/mime.types path exist in the codebase, and the nginx env.test.txt testscript does not assert on the mime.types location, so behavior is unchanged apart from the fix.

Reproduction from the issue (devbox add nginx && devbox services up -b) previously left the service failing with the mime.types [emerg] error; with mime.types placed next to nginx.conf, the config-time include resolves.

cc @jefft (issue reporter)

Community Contribution License

All community contributions in this pull request are licensed to the project
maintainers under the terms of the
Apache 2 License.


Generated by Claude Code

…olves

The nginx plugin created mime.types in the Virtenv directory
({{ .Virtenv }}/mime.types), but nginx.conf lives in the DevboxDir and
uses a relative "include mime.types;" directive. nginx resolves config-time
include paths relative to the config file, not the -p prefix path, so the
service failed to start with:

  [emerg] open() ".../devbox.d/nginx/mime.types" failed (2: No such file
  or directory) in .../devbox.d/nginx/nginx.conf

Place mime.types in the DevboxDir alongside nginx.conf (matching how
fastcgi.conf is already handled) and bump the plugin version.

Fixes #2908

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013yJQ9FtijMB9SfnTeRVC1P
Copilot AI review requested due to automatic review settings July 22, 2026 14:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the nginx plugin startup failure caused by include mime.types; being resolved relative to the generated nginx.conf location (in devbox.d/nginx/), while mime.types was previously created under the virtenv prefix.

Changes:

  • Bump nginx plugin version from 0.0.5 to 0.0.6 so existing environments pick up the fix.
  • Relocate mime.types creation from {{ .Virtenv }} to {{ .DevboxDir }} so include mime.types; resolves during config parsing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

nginx plugin broken due to misplaced mime.types

3 participants