tanbushi commited on
Commit
fffb5c4
·
1 Parent(s): 46fc32c
Files changed (4) hide show
  1. Dockerfile +14 -0
  2. README.md +7 -1
  3. docker-compose.yml +0 -13
  4. nginx/conf.d/default.conf +1 -1
Dockerfile ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nginx:latest
2
+
3
+ # 复制自定义配置文件
4
+ COPY nginx/nginx.conf /etc/nginx/nginx.conf
5
+ COPY nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
6
+
7
+ # 复制静态文件
8
+ COPY nginx/html/ /usr/share/nginx/html/
9
+
10
+ # 暴露端口(Hugging Face Spaces 通常使用 7860)
11
+ EXPOSE 7860
12
+
13
+ # 启动 nginx,监听在 7860 端口
14
+ CMD ["nginx", "-g", "daemon off;"]
README.md CHANGED
@@ -7,7 +7,9 @@ sdk: docker
7
  pinned: false
8
  ---
9
 
10
- # Nginx 服务
 
 
11
 
12
  使用 Docker Compose 运行 nginx 服务器:
13
 
@@ -22,6 +24,10 @@ docker-compose up -d
22
  docker-compose down
23
  ```
24
 
 
 
 
 
25
  ## 配置文件说明
26
 
27
  - `nginx/nginx.conf` - 主配置文件
 
7
  pinned: false
8
  ---
9
 
10
+ # Nginx 服务 for Hugging Face Space
11
+
12
+ ## 本地开发
13
 
14
  使用 Docker Compose 运行 nginx 服务器:
15
 
 
24
  docker-compose down
25
  ```
26
 
27
+ ## Hugging Face Space 部署
28
+
29
+ 此 Space 使用自定义 Dockerfile 配置 nginx 服务器,监听在 7860 端口(Hugging Face Spaces 默认端口)。
30
+
31
  ## 配置文件说明
32
 
33
  - `nginx/nginx.conf` - 主配置文件
docker-compose.yml DELETED
@@ -1,13 +0,0 @@
1
- version: '3.8'
2
-
3
- services:
4
- nginx:
5
- image: nginx:latest
6
- container_name: nginx-server
7
- ports:
8
- - "8080:80"
9
- volumes:
10
- - ./nginx/nginx.conf:/etc/nginx/nginx.conf
11
- - ./nginx/conf.d:/etc/nginx/conf.d
12
- - ./nginx/html:/usr/share/nginx/html
13
- restart: unless-stopped
 
 
 
 
 
 
 
 
 
 
 
 
 
 
nginx/conf.d/default.conf CHANGED
@@ -1,5 +1,5 @@
1
  server {
2
- listen 80;
3
  server_name localhost;
4
 
5
  location / {
 
1
  server {
2
+ listen 7860;
3
  server_name localhost;
4
 
5
  location / {