Skip to content

[BUG] Suggestions for optimizing nginx configuration files #485

@JarmoHu

Description

@JarmoHu

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

If I forward tcp port 30000 to port 443, an error will occur when accessing.
Then I modified the configuration file in nginx, It's all right
original:

    location ^~ /.well-known {
        # The rules in this block are an adaptation of the rules
        # in `.htaccess` that concern `/.well-known`.

        location = /.well-known/carddav { return 301 /remote.php/dav/; }
        location = /.well-known/caldav  { return 301 /remote.php/dav/; }

        location /.well-known/acme-challenge    { try_files $uri $uri/ =404; }
        location /.well-known/pki-validation    { try_files $uri $uri/ =404; }

        # Let Nextcloud's API for `/.well-known` URIs handle all other
        # requests by passing them to the front-end controller.
        return 301 /index.php$request_uri;
    }

modified:

    location ^~ /.well-known {
        # The rules in this block are an adaptation of the rules
        # in `.htaccess` that concern `/.well-known`.

        location = /.well-known/carddav { return 301 $scheme://$http_host/remote.php/dav/; }
        location = /.well-known/caldav  { return 301 $scheme://$http_host/remote.php/dav/; }

        location /.well-known/acme-challenge    { try_files $uri $uri/ =404; }
        location /.well-known/pki-validation    { try_files $uri $uri/ =404; }

        # Let Nextcloud's API for `/.well-known` URIs handle all other
        # requests by passing them to the front-end controller.
        return 301 $scheme://$http_host/index.php$request_uri;
    }

Expected Behavior

No response

Steps To Reproduce

no

Environment

- OS:
- How docker service was installed:

CPU architecture

x86-64

Docker creation

services:
  nextcloud:
    image: linuxserver/nextcloud:latest
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Asia/Shanghai
    volumes:
      - /mnt/myssd1/docker_path/nextcloud/config:/config
      - /mnt/myssd1/docker_path/nextcloud/data:/data
      # - /srv:/srv
    ports:
      - 32080:80
      - 32443:443
      - 30003:30003
      - 30004:30004
    restart: unless-stopped
    depends_on:
      - db
      - redis

  db:
    image: mariadb
    restart: unless-stopped
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - /mnt/myssd1/docker_path/nextcloud/db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=xxx
      - MYSQL_PASSWORD=xxx
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  redis:
    image: redis:alpine
    restart: unless-stopped
    volumes:
      - /mnt/myssd1/docker_path/nextcloud/redis/data:/data

Container logs

no

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions