Web root vs subdirectory

Ref: https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html, explanation of web root vs subdirectory install:

  1. Nextcloud in the webroot of nginx
    The following configuration should be used when Nextcloud is placed in the webroot of your nginx installation. In this example it is /var/www/nextcloud and it is accessed via http(s)://cloud.example.com/

  2. Nextcloud in a subdir of the nginx webroot
    The following config should be used when Nextcloud is placed within a subdir of the webroot of your nginx installation. In this example the webroot is located at /var/www and the Nextcloud instance is accessed via http(s)://cloud.example.com/nextcloud/

My Question:

For #1 above, webroot is /var/www. #1 says path is /var/www/nextcloud. Access by http(s)://server/. The subsequent detailed instructions do not include any /nextcloud dir.

For #2 above, webroot is /var/www. #2 says path is /var/www. Access by http(s)://server/nextcloud/. The subsequent detailed instructions include /nextcloud dir.

Are the path strings above reversed? I.e. /var/www/nextcloud is the subdir one, and /var/www is the webroot one?

Could be. Technically it depends on your configuration because you can change your web root.

With apache2 my vhost nextcloud has its own configuration and webroot matched to nextcloud dir.

OK, I see it now. It is the definition of webroot. Each example shows the following within the .conf file:

  1. Path to the root of your installation

    root /var/www/nextcloud;

  2. Path to the root of your installation

    root /var/www;

It seemed backward, but it makes sense now.

FYI: I used #2 and got it all working in one session. It even has no dav errors. For uses like this nginx is sure a lot easier to get working.

A comment on install instructions: nginx should be the standard, if the goal is to get people up and running. I did get Nc running a few years ago on Apache, but it was a difficult first look at Nc. This time with nginx was a real gem. This is not a negative on Apache, just a positive on a quicker route to Nc.

A big thanks to the responders. It did make me think, and get to my understanding <<

Well there have been some serious concerns with nginx as well. There was a major security flaw in nginx that affected Nextcloud last year. Questions over whether the nginx open source license might be pulled as well. And a lot of people seem to have odd issues with large file uploads with it. Apache is also the base they use for snap and docker and it would be quite a bit of unnecessary work to change.

All I can say on that is I’ve always used Apache and never had an issue with it related to Nextcloud.

Thanks for the insight. My use case is specifically large files so a very relevant consideration.
Through the simpler nginx config, I actually pinpointed my error with my Apache config. I had the root incorrect. Also through the thread of comments here, it led me to get to the real issue I had.
So, my Apache is now running fine, and I have no dav errors.
Don’t get me wrong I have always used Apache, but not at a deep level, so I get caught every now and then.