From ec3ce3e278b1ec8083a04ed32c43db4205032e0e Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 11 Jul 2026 14:04:42 +0000 Subject: [PATCH 1/2] fix(nginx plugin): place mime.types next to nginx.conf so include resolves nginx resolves include directives relative to the config file's directory, not the -p prefix path. The mime.types file was created in the virtenv ($NGINX_PATH_PREFIX) while nginx.conf lives in the devbox.d dir, so `include mime.types;` failed with 'No such file or directory' and the service could not start. Move the create_files destination for mime.types from {{ .Virtenv }} to {{ .DevboxDir }} so it sits alongside nginx.conf, and add the file to the nginx example project. Bump the plugin version to 0.0.6. Fixes #2908 Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_017uK5pHhERaRaoDAvNdw9ww --- .../servers/nginx/devbox.d/nginx/mime.types | 98 +++++++++++++++++++ plugins/nginx.json | 4 +- 2 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 examples/servers/nginx/devbox.d/nginx/mime.types diff --git a/examples/servers/nginx/devbox.d/nginx/mime.types b/examples/servers/nginx/devbox.d/nginx/mime.types new file mode 100644 index 00000000000..ad2edcf4a3c --- /dev/null +++ b/examples/servers/nginx/devbox.d/nginx/mime.types @@ -0,0 +1,98 @@ +types { + text/html html htm shtml; + text/css css; + text/xml xml; + image/gif gif; + image/jpeg jpeg jpg; + application/javascript js; + application/atom+xml atom; + application/rss+xml rss; + + text/mathml mml; + text/plain txt; + text/vnd.sun.j2me.app-descriptor jad; + text/vnd.wap.wml wml; + text/x-component htc; + + image/avif avif; + image/png png; + image/svg+xml svg svgz; + image/tiff tif tiff; + image/vnd.wap.wbmp wbmp; + image/webp webp; + image/x-icon ico; + image/x-jng jng; + image/x-ms-bmp bmp; + + font/woff woff; + font/woff2 woff2; + + application/java-archive jar war ear; + application/json json; + application/mac-binhex40 hqx; + application/msword doc; + application/pdf pdf; + application/postscript ps eps ai; + application/rtf rtf; + application/vnd.apple.mpegurl m3u8; + application/vnd.google-earth.kml+xml kml; + application/vnd.google-earth.kmz kmz; + application/vnd.ms-excel xls; + application/vnd.ms-fontobject eot; + application/vnd.ms-powerpoint ppt; + application/vnd.oasis.opendocument.graphics odg; + application/vnd.oasis.opendocument.presentation odp; + application/vnd.oasis.opendocument.spreadsheet ods; + application/vnd.oasis.opendocument.text odt; + application/vnd.openxmlformats-officedocument.presentationml.presentation + pptx; + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + xlsx; + application/vnd.openxmlformats-officedocument.wordprocessingml.document + docx; + application/vnd.wap.wmlc wmlc; + application/wasm wasm; + application/x-7z-compressed 7z; + application/x-cocoa cco; + application/x-java-archive-diff jardiff; + application/x-java-jnlp-file jnlp; + application/x-makeself run; + application/x-perl pl pm; + application/x-pilot prc pdb; + application/x-rar-compressed rar; + application/x-redhat-package-manager rpm; + application/x-sea sea; + application/x-shockwave-flash swf; + application/x-stuffit sit; + application/x-tcl tcl tk; + application/x-x509-ca-cert der pem crt; + application/x-xpinstall xpi; + application/xhtml+xml xhtml; + application/xspf+xml xspf; + application/zip zip; + + application/octet-stream bin exe dll; + application/octet-stream deb; + application/octet-stream dmg; + application/octet-stream iso img; + application/octet-stream msi msp msm; + + audio/midi mid midi kar; + audio/mpeg mp3; + audio/ogg ogg; + audio/x-m4a m4a; + audio/x-realaudio ra; + + video/3gpp 3gpp 3gp; + video/mp2t ts; + video/mp4 mp4; + video/mpeg mpeg mpg; + video/quicktime mov; + video/webm webm; + video/x-flv flv; + video/x-m4v m4v; + video/x-mng mng; + video/x-ms-asf asx asf; + video/x-ms-wmv wmv; + video/x-msvideo avi; +} diff --git a/plugins/nginx.json b/plugins/nginx.json index 37dcd875757..3f627fb30ea 100644 --- a/plugins/nginx.json +++ b/plugins/nginx.json @@ -1,6 +1,6 @@ { "name": "nginx", - "version": "0.0.5", + "version": "0.0.6", "description": "nginx can be configured with env variables\n\nTo customize:\n* Use $NGINX_CONFDIR to change the configuration directory\n* Use $NGINX_TMPDIR to change the tmp directory. Use $NGINX_USER to change the user\n* Use $NGINX_WEB_PORT to change the port NGINX runs on. \n Note: This plugin uses envsubst when running `devbox services` to generate the nginx.conf file from the nginx.template file. To customize the nginx.conf file, edit the nginx.template file.\n", "packages": ["gettext@latest", "gawk@latest"], "env": { @@ -14,7 +14,7 @@ }, "create_files": { "{{ .Virtenv }}/temp": "", - "{{ .Virtenv }}/mime.types": "nginx/mime.types", + "{{ .DevboxDir }}/mime.types": "nginx/mime.types", "{{ .Virtenv }}/process-compose.yaml": "nginx/process-compose.yaml", "{{ .DevboxDir }}/nginx.template": "nginx/nginx.template", "{{ .DevboxDir }}/nginx.conf": "nginx/nginx.conf", From b39af3a73b662b61b46797378540da066b3e4326 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 11 Jul 2026 14:10:25 +0000 Subject: [PATCH 2/2] fix(nginx plugin): copy mime.types next to nginx.conf at service start MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Keep mime.types in the virtenv (which lives under .devbox and is always regenerated) and copy it into $NGINX_CONFDIR at service startup when missing, instead of relying on create_files to place it in devbox.d. Manager.shouldCreateFile() skips creating any devbox.d file once a plugin is installed (PluginVersion set in devbox.lock), so placing mime.types in {{ .DevboxDir }} would not remediate existing nginx installs. Doing the copy from process-compose.yaml — also regenerated under .devbox — fixes both fresh and already-installed projects. Addresses review feedback on #2908. --- plugins/nginx.json | 2 +- plugins/nginx/process-compose.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/nginx.json b/plugins/nginx.json index 3f627fb30ea..62b70a1512b 100644 --- a/plugins/nginx.json +++ b/plugins/nginx.json @@ -14,7 +14,7 @@ }, "create_files": { "{{ .Virtenv }}/temp": "", - "{{ .DevboxDir }}/mime.types": "nginx/mime.types", + "{{ .Virtenv }}/mime.types": "nginx/mime.types", "{{ .Virtenv }}/process-compose.yaml": "nginx/process-compose.yaml", "{{ .DevboxDir }}/nginx.template": "nginx/nginx.template", "{{ .DevboxDir }}/nginx.conf": "nginx/nginx.conf", diff --git a/plugins/nginx/process-compose.yaml b/plugins/nginx/process-compose.yaml index 128a4a54531..5bf747bd28d 100644 --- a/plugins/nginx/process-compose.yaml +++ b/plugins/nginx/process-compose.yaml @@ -4,6 +4,7 @@ processes: nginx: command: | if [ -f $NGINX_CONFDIR/nginx.template ]; then envsubst $(awk 'BEGIN {for (k in ENVIRON) {printf "$"k","}}') < $NGINX_CONFDIR/nginx.template > $NGINX_CONFDIR/nginx.conf; fi + if [ ! -f $NGINX_CONFDIR/mime.types ] && [ -f $NGINX_PATH_PREFIX/mime.types ]; then cp $NGINX_PATH_PREFIX/mime.types $NGINX_CONFDIR/mime.types; fi nginx -p $NGINX_PATH_PREFIX -c $NGINX_CONFDIR/nginx.conf -e error.log -g "pid nginx.pid;daemon off;" availability: restart: on_failure