NGINX /etc/nginx/http.d/default.conf

Original 📋 Alpine Linux v3.21 17 lines

Works On

Viewing:
Alpine Linux v3.21
Same on:
Other versions:

Details

Size
17 lines
MD5
c4759cd2812220ab542317f54fbbe755
SHA256
f53fd49af9b4bc308653abb85d9989879ce1fb48e43c508f5f45c84f74513865
/etc/nginx/http.d/default.conf
# This is a default site configuration which will simply return 404, preventing
# chance access to any other virtualhost.

server {
	listen 80 default_server;
	listen [::]:80 default_server;

	# Everything is a 404
	location / {
		return 404;
	}

	# You may need this to prevent return 404 recursion.
	location = /404.html {
		internal;
	}
}

Copy & Paste

curl:
curl https://exampleconfig.com/api/v1/config/original/c4759cd2812220ab542317f54fbbe755?hint=default.conf
wget:
wget -O default.conf https://exampleconfig.com/api/v1/config/original/c4759cd2812220ab542317f54fbbe755?hint=default.conf

For AI Agents

<prompt><role>DevOps agent</role><source url='https://exampleconfig.com/api/v1/config/original/c4759cd2812220ab542317f54fbbe755?hint=default.conf' /><config><app>NGINX</app><os>Alpine Linux v3.21</os><location>/etc/nginx/http.d/default.conf</location><lines>17</lines><md5>c4759cd2812220ab542317f54fbbe755</md5><sha256>f53fd49af9b4bc308653abb85d9989879ce1fb48e43c508f5f45c84f74513865</sha256></config></prompt>

Paste into Claude, ChatGPT, or any AI assistant.

Install NGINX

Alpine Linux

sudo apk add nginx

Debian

sudo apt update && sudo apt install nginx

Red Hat Enterprise Linux

sudo yum install nginx

Ubuntu

sudo apt update && sudo apt install nginx

File Location

File Path
/etc/nginx/http.d/default.conf
Directory
/etc/nginx/http.d/
Significance
System-wide configuration directory
Description
Files in /etc/ contain system-wide configuration settings that affect all users.

FAQ

When should I use this default.conf?

Use it to restore a missing default, confirm what shipped, or diff against your current NGINX config.

How do I restore NGINX defaults?

Download the file, back up the current one in /etc/nginx/http.d/default.conf, replace it, then reload or restart NGINX.

Is default.conf safe for production?

It is the vendor default for Alpine Linux v3.21. Treat it as a baseline and review security and performance settings before production use.

How does this differ from other OS versions?

Defaults vary by distro and version. This copy matches Alpine Linux v3.21.

Can I use this for NGINX troubleshooting?

Yes. Diff it against yours to find drift, then restore only the sections you need.