Hi Everyone,

I am trying to run a small nextcloud website and I'm having a problem with
the URLs.
I installed nextcloud via pkg_add, and all of its files were installed
under /var/www/nextcloud.
The pkg-readmes were helpful in getting nextcloud working with httpd.

However, though everything "works", my URLs look like this:
-   www.domain.com/nextcloud/index.php/foo/bar/...

And I can't for the life of me seem to edit /etc/httpd.conf to make it so
my URLs look like this:
-   www.domain.com/index.php/foo/bar/...

Furthermore, I can only access nextcloud if I navigate to
-   www.domain.com/nextcloud

I would prefer to access nextcloud by navigating to
-   www.domain.com


Even if I add the following line to /etc/httpd.conf, it works only in the
web browser and nextcloud-specific iOS apps don't fully work properly:
-   location "/" { block return 301 "nextcloud/index.php" }


My /etc/httpd.conf is below.
Am I missing something obvious?

Before anyone asks, removing "/nextcloud" from each of the location strings
does not work.
When I do that I get an "ERR_EMPTY_RESPONSE" error in my browser (Chrome).
My httpd.conf below was inspired by the one outlined in the nextcloud
pkg-readme.

Thanks in advance.

server "www.domain.com" {
        listen on * tls port 443

        # acme-challenge TLS location
        location "/.well-known/acme-challenge/*" {
                root "/acme"
                request strip 2
        }

        # enable HTTP Strict Transport Security
        hsts {
                preload
                subdomains
                max-age 15768000
        }

        tls {
                certificate "/etc/ssl/domain.com.fullchain.pem"
                key "/etc/ssl/private/domain.com.key"
        }

        # set root directory
        root "/nextcloud"
        directory index "index.php"

        # set max upload size to 1G (in bytes)
        connection max request body 1048576000
        connection max requests 1000
        connection request timeout 3600
        connection timeout 3600

        block drop

        # ensure that no "*.php*" files can be fetched from these directories
        location "/nextcloud/config/*" { block drop }
        location "/nextcloud/data/*" { block drop }
        location "/nextcloud/*.php*" {
                root "/nextcloud"
                request strip 1
                fastcgi socket "/run/php-fpm.sock"
                pass
        }

        location "/nextcloud/dist/*" {
                root "/nextcloud"
                request strip 1
                pass
        }

        location "/nextcloud/apps/*" {
                root "/nextcloud"
                request strip 1
                pass
        }

        location "/nextcloud/core/*" {
                root "/nextcloud"
                request strip 1
                pass
        }

        location "/nextcloud/updater/*" {
                root "/nextcloud"
                request strip 1
                pass
        }

        location "/nextcloud" { block return 301 "$DOCUMENT_URI/index.php" }
        location "/nexctloud/" { block return 301 "$DOCUMENT_URI/index.php" }
        location "/.well-known/carddav" { block return 301
"https://$SERVER_NAME/nextcloud/remote.php/dav"; }
        location "/.well-known/caldav" { block return 301
"https://$SERVER_NAME/nextcloud/remote.php/dav"; }
        location "/.well-known/webfinger" { block return 301
"/nextcloud/index.php/.well-known/webfinger" }
        location "/.well-known/nodeinfo" { block return 301
"/nextcloud/index.php/.well-known/nodeinfo" }

        location "/nextcloud/ocs-provider/*" {
                block return 301 "$DOCUMENT_URI/index.php"
        }

        location "/nextcloud/ocm-provider/*" {
                block return 301 "$DOCUMENT_URI/index.php"
        }
}

Reply via email to