# Alpine Linux Docker 中 Nginx 配置文件

**URL:** <https://www.isharkfly.com/t/alpine-linux-docker-nginx/15749>\
**Category:** DevOps\
**Tags:** docker, linux\
**Created:** [May 14, 2024, 10:03pm UTC](https://www.isharkfly.com/t/alpine-linux-docker-nginx/15749 "2024-05-14T22:03:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hex](https://www.isharkfly.com/user_avatar/www.isharkfly.com/hex/32/21953_2.png) [@hex](https://www.isharkfly.com/u/hex)\
**Post date:** [May 14, 2024, 10:03pm UTC](https://www.isharkfly.com/t/alpine-linux-docker-nginx/15749/1 "2024-05-14T22:03:03Z")

</div>

与 RHEL 及其衍生 Linux 的配置不同。

Alpine Linux 中 nginx 的配置文件在：`/etc/nginx/http.d` 目录下。

这个与其他操作系统中的 conf.d 目录中保存配置文件是不一样的。

 ![2024-05-14_18-00-49](https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/2X/5/54bf2ae51cea1a6f3164318619ce3e9915f09df3.png)

当我们用 Docker 容器管理器打开文件夹的文件的时候，我们可以看到文件的内容。

 ![2024-05-14_18-01-26](https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/2X/a/aad530b24465bda51321f2da826f58c00c81cc3f.png)

需要注意的是这个配置文件是以 server 为包裹的扩展配置文件。

内容大致为：

```bash
# 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;
	}
}

```

上面的内容。
