# Download file from server via nginx docker

Crete struct folder like this:&#x20;

<figure><img src="/files/sYkKIS9Rw3BpVfr6RgHw" alt=""><figcaption></figcaption></figure>

1. Put all your download files into **files**  folder

<figure><img src="/files/cNMgLRVSFotqOcV8iY8n" alt=""><figcaption></figcaption></figure>

1. Create file conf/dowload.conf

```
server {
  listen 80;
  server_name _;
  # serve the static files on port 80
  location /downloads/ {
    alias /files/;
  }
}
```

3. Create docker compose file:

```
version: '3'

services:
  nginx:
    image: nginx:latest
    volumes:
      - ./files:/files
      - ./conf:/etc/nginx/conf.d
    ports:
      - "8080:80"
```

4. Start docker container

```
docker compose up -d
```

5. Download files

```
curl http://your_ip:8080/downloads/files.sql.gz
```

6. Shutdown container after download

```
docker compose down
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev-notes.vinguyen.blog/notes/deployment-and-operation/ngnix/download-file-from-server-via-nginx-docker.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
