diced / zipline

A ShareX/file upload server that is easy to use, packed with features, and with an easy setup!
https://zipline.diced.sh/
MIT License
1.49k stars 140 forks source link

Bug: nginx is unable to connect to Docker? #559

Closed topmask closed 4 months ago

topmask commented 4 months ago

What happened?

A bug happened!

Version

latest (ghcr.io/diced/zipline or ghcr.io/diced/zipline:latest)

What browser(s) are you seeing the problem on?

No response

Zipline Logs

services:
  postgres:
    image: postgres:15
    restart: unless-stopped
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DATABASE=postgres
    volumes:
      - ./pg_data:/var/lib/postgresql/data
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -U postgres']
      interval: 10s
      timeout: 5s
      retries: 5

  zipline:
    image: ghcr.io/diced/zipline
    ports:
      - '127.0.0.1:3333:3333'
    restart: unless-stopped
    environment:
      - CORE_RETURN_HTTPS=false
      - CORE_SECRET=f2Ddasdasdasdasd
      - CORE_HOST=127.0.0.1
      - CORE_PORT=3333
      - CORE_DATABASE_URL=postgres://postgres:postgres@postgres/postgres
      - CORE_LOGGER=true
    volumes:
      - '/mnt/data/download/zipline/uploads:/zipline/uploads'
      - '/mnt/data/download/zipline/public:/zipline/public'
    depends_on:
      - 'postgres'

volumes:
  pg_data:

2024-06-05 08:12:12,064 AM info [datasource] using Local(./uploads) datasource 2024-06-05 08:12:12,145 AM info [database::migrations] establishing database connection 2024-06-05 08:12:12,147 AM info [database::migrations] ensuring database exists, if not creating database - may error if no permissions 2024-06-05 08:12:12,699 AM info [database::migrations] finished migrating database 2024-06-05 08:12:15,004 AM info [server] listening on 127.0.0.1:3333 2024-06-05 08:12:15,005 AM info [server] started production zipline@3.7.9 server


### Browser Logs

```shell
server {
     listen 80;
     listen [::]:80;
     server_name img.xxx.xyz;
     return 301 https://img.xxx.xyz$request_uri;

##SSL认证
     include snippets/ssl/letsencrypt.conf;

}

server {
     listen 443 ssl;
     listen [::]:443 ssl;
     server_name img.xxx.xyz;

####ssl证书路径
     ssl_certificate /etc/letsencrypt/live/img.xxx.xyz/fullchain.pem;
     ssl_certificate_key /etc/letsencrypt/live/img.xxx.xyz/privkey.pem;
     ssl_dhparam /etc/letsencrypt/live/img.xxx.xyz/dhparam.pem;

###SSL认证
     include snippets/ssl/letsencrypt.conf;

### SSL rules
     include snippets/ssl/ssl.conf;

##日志
     access_log /var/log/nginx/img.xxx.xyz.access.log;
     error_log /var/log/nginx/img.xxx.xyz.error.log error;

location / {

#    proxy_pass http://localhost:3333;
    proxy_pass http://127.0.0.1:3333;

    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

}

nginx


2024/06/05 08:12:33 [error] 105686#105686: *109 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: , server: img.xxx.xyz, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:3333/", host: "img.xxx.xyz"
2024/06/05 08:12:33 [error] 105686#105686: *109 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: , server: img.xxx.xyz, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:3333/favicon.ico", host: "img.xxx.xyz", referrer: "https://img.xxx.xyz/"


### Additional Info

_No response_
diced commented 4 months ago

you need to have the CORE_HOST set to 0.0.0.0 if you are using docker, otherwise it won't expose that port