How can I use my domain and port

[details=“Support intro”]

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 29.0.9
  • Operating system and version (e.g., Ubuntu 24.04):
    • fedora 41
  • Web server and version (e.g, Apache 2.4.25):
    • apache
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • nginx 1.27.2
  • Is this the first time you’ve seen this error? (Yes / No):
    • yes
  • When did this problem seem to first start?
    • When I want to use https://myDomian:port to login nextCloud system
  • Installation method (e.g. AIO, NCP, Bare Metal/Archive, etc.)
    • AIO
  • Are you using Cloudflare, mod_security, or similar? (Yes / No)
    • No

Summary of the issue you are facing:

I have deployed AIO and reverse server in my home server through docker. The nginx container is in another docker and has been connected to nextcloud-aio network. I can visit the conifg page and fill my domain in that page. But after that when I need to use port 4080 to use this system and I always get into https://myDomain/login as redirction.

1、I must use https://myDomain:4080/login to visit my nextcloud page. How can I change the config to achieve that?

2、I have change the config.php file manually in the aio-nextcloud container and restart aio-nextcloud container and aio-apache container. But it did not work. The config I changed:

overwritehost => ‘myDomain:4080’
overwrite.cli.url => ‘https://myDomain:4080/

3、I also try to use occ command. But every time I change overwritehost and get feedback which changed successfully, nothing changed if I use ‘config:list’ command to check

I hope I can be redircted to https://myDomain:port/login if I use http://myDomain:port and can get into login page successfully.

Web Browser

A 404 error will be received from nginx if I use https://cloud.zhangxiaoyan.net.cn:4080/login

Web server / Reverse Proxy

The output of your Apache/nginx/system log in /var/log/____:

2024/11/26 02:07:11 [error] 499#499: *97539 open() "/etc/nginx/html/login" failed (2: No such file or directory), client: 60.12.1.43, server: cloud.zhangxiaoyan.net.cn, request: "GET /login HTTP/2.0", host: "cloud.zhangxiaoyan.net.cn:4080"

Configuration

Nextcloud

The output of occ config:list system is blow:

{
    "system": {
        "one-click-instance": true,
        "one-click-instance.user-limit": 100,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "check_data_directory_permissions": false,
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "overwritehost": "myDomain",
        "overwriteprotocol": "https",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "myDomain",
            "192.168.200.50:11000"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "29.0.9.2",
        "overwrite.cli.url": "https:\/\/myDomin\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "updatedirectory": "\/nc-updater",
        "loglevel": 2,
        "app_install_overwrite": [
            "nextcloud-aio"
        ],
        "log_type": "file",
        "logfile": "\/var\/www\/html\/data\/nextcloud.log",
        "log_rotate_size": 10485760,
        "log.condition": {
            "apps": [
                "admin_audit"
            ]
        },
        "preview_max_x": 2048,
        "preview_max_y": 2048,
        "jpeg_quality": 60,
        "enabledPreviewProviders": {
            "1": "OC\\Preview\\Image",
            "2": "OC\\Preview\\MarkDown",
            "3": "OC\\Preview\\MP3",
            "4": "OC\\Preview\\TXT",
            "5": "OC\\Preview\\OpenDocument",
            "6": "OC\\Preview\\Movie",
            "7": "OC\\Preview\\Krita",
            "0": "OC\\Preview\\Imaginary"
        },
        "enable_previews": true,
        "upgrade.disable-web": true,
        "mail_smtpmode": "smtp",
        "trashbin_retention_obligation": "auto, 30",
        "versions_retention_obligation": "auto, 30",
        "activity_expire_days": 30,
        "simpleSignUpLink.shown": false,
        "share_folder": "\/Shared",
        "one-click-instance.link": "https:\/\/nextcloud.com\/all-in-one\/",
        "upgrade.cli-upgrade-link": "https:\/\/github.com\/nextcloud\/all-in-one\/discussions\/2726",
        "maintenance_window_start": 100,
        "allow_local_remote_servers": true,
        "davstorage.request_timeout": 3600,
        "htaccess.RewriteBase": "\/",
        "dbpersistent": false,
        "auth.bruteforce.protection.enabled": true,
        "ratelimit.protection.enabled": true,
        "files_external_allow_create_new_local": false,
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "preview_imaginary_url": "***REMOVED SENSITIVE VALUE***",
        "preview_imaginary_key": "***REMOVED SENSITIVE VALUE***",
        "DOMAIN": "myDomain"
    }

Nginx Config

And this is my nginx config. I can be redirect to https from http. But always loss port

server {
    server_name myDomain;
    listen      80 ssl;
    listen  [::]:80 ssl;
    listen    4080 ssl;
    listen  [::]:4080 ssl;

    if ($scheme = "http") {
        return 301 https://$host:$server_port$request_uri;
    }
    charset     UTF-8;

    http2 on;
    http3 on;
    quic_retry on;
    add_header Alt-Svc 'h3=":443"; ma=86400';

    sendfile on;

    location = / {
        proxy_pass http://172.18.0.8:11000$request_uri;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_set_header X-Forwarded-Scheme $scheme;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;

        proxy_request_buffering off;
        proxy_read_timeout 86400s;
        client_max_body_size 0;

        # Websocket
        proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $http_connection_upgrade;
    }
    ssl_certificate /etc/nginx/ssl/domain.pem;
    ssl_certificate_key /etc/nginx/ssl/domain.key;

    ssl_session_timeout 1d;
    ssl_session_cache shared:MozSSL:10m;
    ssl_session_tickets off;

    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305;
    ssl_prefer_server_ciphers on;


}

Hi, see GitHub - nextcloud/all-in-one: 📦 The official Nextcloud installation method. Provides easy deployment and maintenance with most features included in this one Nextcloud instance.

1 Like

You can check my settings here - Nextcloud AIO installation.