Installing Nextcloud with a custom address ip/Nextcloud

Hi!
I need some help with installing Nextcloud using Docker Compose.

Nextcloud installs successfully and is accessible at http://ip:8080, but I would like it to be available at http://ip/Nextcloud.

I tried changing the Apache configuration, and in that case, Nextcloud does open at the desired address (ip/Nextcloud), but then the files stop working or become inaccessible (e.g., errors when loading or opening them).

Has anyone faced a similar issue or can advise how to properly configure the /Nextcloud path when accessing through a web server?

Any help would be greatly appreciated!

Hello there @Denis_WebDev,

you started a topic in development category. This category is intended for active developers of the core or apps in the Nextcloud ecosystem.
From the description in your topic, it is not clear if you are seeking help and advice about a concrete problem you have or you want to actually develop the corresponding solution.

Please specify explicitly the required information to help you best. These are:

  1. What you want to achieve
  2. What you have done so far
  3. What is failing
  4. What you expect from the forum community

Without additional information the community members cannot help you in an efficient manner. Please keep in mind that the help here in the forum are mostly based on work of volunteers and thus it is just fair to reduce the burden on them.

If you accidentally posted in the category, just give a hint and a moderator can move the corresponding category.

Regards,
christianlupus

This is not recommended.

Hello @Denis_WebDev,

welcome to the Nextcloud community! :handshake:

for NGINX you can check out the docs

as Community Docker image is intended to be used with reverse proxy respective config options will help you

1 Like

Thank you for your message. Yes, I did mistakenly post in the wrong category — sorry for the inconvenience.

My issue is that I’m trying to change the default Nextcloud URL from the root path to http://IP/nextcloud, but I’m encountering an error when uploading files.

I would appreciate any help or advice on how to properly configure the URL path.

Thank you for your understanding!

Hello wwe,

Thank you very much for your help and the useful links!

Here is my Docker Compose file setup, which I share here in case someone else might find it helpful:

version: '3.3'

services:
  nextcloud:
    image: nextcloud
    container_name: nextcloud
    restart: always
    environment:
      MYSQL_PASSWORD: xxx
      MYSQL_DATABASE: nextcloud
      MYSQL_USER: xxx
      MYSQL_HOST: mariadb
      OVERWRITEWEBROOT: /nextcloud
      OVERWRITEHOST: 192.168.31.14
      OVERWRITEPROTOCOL: http
      TRUSTED_PROXIES: 192.168.31.14
      APACHE_DISABLE_REWRITE_IP: 1
    ports:
      - 8081:80
    volumes:
      - /media/hdd/Nextcloud/nextcloud:/var/www/html
      - /mnt/nextcloud:/var/www/html/data
      - /media/hdd/Nextcloud/config:/var/www/html/config
      - /media/hdd/Nextcloud/custom_apps:/var/www/html/custom_apps
      - /media/hdd/Nextcloud/themes:/var/www/html/themes
    networks:
      - mariadb_net

networks:
  mariadb_net:
    external: true

And my Apache configuration looks like this:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName 192.168.31.14

    DocumentRoot /var/www/html

    ProxyPreserveHost On
    ProxyPass /nextcloud http://localhost:8081/
    ProxyPassReverse /nextcloud http://localhost:8081/

    <Location /nextcloud/>
        Require all granted
    </Location>

    ErrorLog ${APACHE_LOG_DIR}/nextcloud_error.log
    CustomLog ${APACHE_LOG_DIR}/nextcloud_access.log combined
</VirtualHost>

However, the problem with file uploads remains. Currently, it tries to upload files using the WebDAV URL:
http://192.168.31.14/nextcloud/remote.php/dav/files/Mexanik385

But I need it to upload files using:
http://192.168.31.14:8081/remote.php/dav/files/Mexanik385

Or somehow adjust the accessibility of this file URL for the new path.

If you have any suggestions on how to fix this WebDAV path issue or how to properly configure file upload to work with the /nextcloud subpath, I would really appreciate it!

Thanks again for your support!

if I got you right you want to add the custom port 8081and remove /nextcloud/ from the path?

in this case I would try to

  • add the port to OVERWRITEHOST
  • remove OVERWRITEWEBROOT from the config
  • do the full compose down/up cycle
  • review effective config with docker compose exec nextcloud ./occ config:list system after restart

Thank you for your response! I may not have expressed myself clearly.

What I actually need is for everything to work with /nextcloud in the path. The web interface is already accessible at: http://192.168.31.14/nextcloud

and I want the files to be uploaded via WebDAV at:

http://192.168.31.14/nextcloud/remote.php/dav/files/Mexanik385

Currently, when I try to access that URL, I get an error — even though the Nextcloud web panel itself is working fine.

Maybe there’s something wrong with the overwritewebroot setting or with the proxy configuration?

nobody knows as you didn’t provide further details.

as Nextcloud suggest the right IP i assume there is something outside like reverse proxy etc..

I would look into the logs of you apache reverseproxy and docker logs (docker compose logs nextcloud) also review nextcloud.log- as your webdav test shows as Nextcloud error the request must reach the system and you could see what is missing - proxy headers, etc..