nginx: [emerg] open() failed (2: No such file or directory) Nginx / Apache Origin: Edge & web server OSI layer 7 · Application Last updated 5 Nov 2026

Nginx: nginx: [emerg] open() "/etc/nginx/snippets/fastcgi-php.conf" failed (2: No such file or directory) in /etc/nginx/sites-enabled/app:20

The config includes a file (snippet, certificate, ssl option file) that doesn't exist.

Exact message you may see nginx: [emerg] open() "/etc/nginx/snippets/fastcgi-php.conf" failed (2: No such file or directory)[emerg] open() failed (2: No such file or directory) in /etc/nginxnginx: [emerg] BIO_new_file("/etc/letsencrypt/live/x/fullchain.pem") failed[emerg] cannot load certificate ... BIO_new_file() failed no such fileopen() "/etc/nginx/mime.types" failed (2: No such file or directory)
Seen on: Nginx Linux

Meaning

Fix the path, create the file, or install the package providing it (snippets/fastcgi-php.conf from Debian/Ubuntu's nginx packages; options-ssl-nginx.conf from certbot). With include /path/*.conf; globs a missing directory is ignored, but a direct include fails.

Common causes

  • Snippet/include file missing
  • Certificate or key path wrong
  • Package not installed (certbot nginx files)
  • Relative include resolved from the wrong dir
  • File renamed

⚡ Quick fix

  1. ls -l the path in the message
  2. Reinstall the package or create the file
  3. Correct the include/ssl_certificate path

Detailed fix by platform

Linux

  1. sudo nginx -t then ls -l /etc/nginx/snippets /etc/letsencrypt/live/DOMAIN

How to diagnose

  1. Path — Exists?
  2. Package — Provides it?
  3. Include — Relative base?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Edge & web server. Errors that are often confused with or caused by this one (click to open):

Cannot redeclare — Fatal error: Cannot redeclare function foo() (previously declared in …) (PHP)Cannot redeclareCould not automatically find a matching server block — Certbot: Could not automatically find a matching server block for example.com. Set the `server_name` directive to use the Nginx installer (SSL / TLS)Could not automatical…could not build the server_names_hash, you should increase server_names_hash_bucket_size — Nginx: nginx: [emerg] could not build the server_names_hash, you should increase server_names_hash_bucket_size: 64 (Nginx / Apache)could not build the s…failed to open stream — Warning: include(x.php): Failed to open stream: No such file or directory (PHP)failed to open streamnginx: [emerg] unexpected end of file, expecting ";" or "}" — Nginx: nginx: [emerg] unexpected end of file, expecting ";" or "}" in /etc/nginx/conf.d/site.conf:42 (Nginx / Apache)nginx: [emerg] unexpe…nginx: bind() to 0.0.0.0:80 failed (13: Permission denied) — Nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied) (Nginx / Apache)nginx: bind() to 0.0.…nginx: conflicting server name ignored — Nginx: nginx: [warn] conflicting server name "example.com" on 0.0.0.0:80, ignored (Nginx / Apache)nginx: conflicting se…nginx: directive is not terminated by ";" — Nginx: nginx: [emerg] directive "proxy_pass" is not terminated by ";" in /etc/nginx/sites-enabled/app:15 (Nginx / Apache)nginx: directive is n…nginx: [e…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.