Wednesday, May 22, 2024

Re: httpd & nextcloud

Hi Souji,

Your tip led me in the right direction and I now have what I need. Thank you!

One thing to note. I had to add the following line to get everything to work:
-   location "/" { block return 301 "$https://$SERVER_NAME/index.php" }

I added this line because, for some reason, without this line, navigating to "www.domain.com" would fail.
But I noticed that navigating specifically to "www.domain.com/index.php" worked.

For posterity's sake, here is my "working" /etc/httpd.conf:

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.io.fullchain.pem"                  key "/etc/ssl/private/domain.io.key"          }            # set max upload size to 1G (in bytes)          connection max request body 1048576000          connection max requests 1000          connection request timeout 3600          connection timeout 3600            # set root directory          root "/nextcloud"          directory index "index.php"

block drop # ensure that no "*.php*" files can be fetched from these directories location "/config/*" { block drop } location "/data/*" { block drop } location "/*.php*" { root "/nextcloud" fastcgi socket "/run/php-fpm.sock" pass } location "/dist/*" { root "/nextcloud" pass } location "/apps/*" { root "/nextcloud" pass } location "/core/*" { root "/nextcloud" pass } location "/updater/*" { root "/nextcloud" pass }
location "/" { block return 301 "https://$SERVER_NAME/index.php" } location "/nextcloud" { block return 301 "$DOCUMENT_URI/index.php" } location "/nextcloud/" { block return 301 "$DOCUMENT_URI/index.php" } location "/.well-known/carddav" { block return 301 "https://$SERVER_NAME/remote.php/dav" } location "/.well-known/caldav" { block return 301 "https://$SERVER_NAME/remote.php/dav" } location "/.well-known/webfinger" { block return 301 "/index.php/.well-known/webfinger" } location "/.well-known/nodeinfo" { block return 301 "/index.php/.well-known/nodeinfo" } location "/ocs-provider/*" { block return 301 "$DOCUMENT_URI/index.php" } location "/ocm-provider/*" { block return 301 "$DOCUMENT_URI/index.php" } }


On Wed, May 22, 2024 at 9:58 AM Souji Thenria <mail@souji-thenria.net> wrote:
On Wed May 22, 2024 at 2:38 PM BST, Am Jam wrote:
> Hi Everyone,

Hi Am,

> 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.

Did you also remove the line: 'request strip 1'?

So that instead of
>         location "/nextcloud/*.php*" {
>                 root "/nextcloud"
>                 request strip 1
>                 fastcgi socket "/run/php-fpm.sock"
>                 pass
>         }

you should have:
location "/*.php*" {
        root "/nextcloud"
        fastcgi socket "/run/php-fpm.sock"
        pass
}


Regards,
Souji

No comments:

Post a Comment