question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nextcloud Nginx Conf

See original GitHub issue

How can I add the nginx conf example from nextcloud docs? https://docs.nextcloud.com/server/19/admin_manual/installation/nginx.html

when I add most of this in advanced in webui it works.

but when I add some things wich contains locations I don’t get it to work:

    location / {
        rewrite ^ /index.php;
    }

    location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
        deny all;
    }
    location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
        deny all;
    }

    location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) {
        fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
        set $path_info $fastcgi_path_info;
        try_files $fastcgi_script_name =404;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $path_info;
        fastcgi_param HTTPS on;
        # Avoid sending the security headers twice
        fastcgi_param modHeadersAvailable true;
        # Enable pretty urls
        fastcgi_param front_controller_active true;
        fastcgi_pass php-handler;
        fastcgi_intercept_errors on;
        fastcgi_request_buffering off;
    }

    location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) {
        try_files $uri/ =404;
        index index.php;
    }
    location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap|mp4|webm)$ {
        try_files $uri /index.php$request_uri;
        # Optional: Don't log access to other assets
        access_log off;
    }

this all. seems not to work for me 😕 (as an example)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
groundglasscommented, Jun 13, 2020

How can I add the nginx conf example from nextcloud docs? https://docs.nextcloud.com/server/19/admin_manual/installation/nginx.html

when I add most of this in advanced in webui it works.

this all. seems not to work for me 😕 (as an example)

I am running Nextcloud ver 19 This is what works for me in NPM:

  • Turn on Websockets
  • Force SSL
  • HSTS Enabled
  • HTTP/2

In Advanced

    location = /.well-known/carddav {
      return 301 $scheme://$host:$server_port/remote.php/dav;
    }
    location = /.well-known/caldav {
      return 301 $scheme://$host:$server_port/remote.php/dav;
    }

With this setting I got no security errors/warnings in NC->Settings->Admin->Security & setup warnings

3reactions
Neehamcommented, Dec 13, 2020

In my case, I was still getting an error but after removing the :$server_port it worked. I am assuming this is because the proxy host is already port forwarding when accessing /remote.php/dav

Putting this under Advanced worked for me:

location = /.well-known/carddav {
  return 301 $scheme://$host/remote.php/dav;
}
location = /.well-known/caldav {
  return 301 $scheme://$host/remote.php/dav;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

NGINX configuration - Nextcloud Documentation
The following config should be used when Nextcloud is placed within a subdir of the webroot of your nginx installation. In this example...
Read more >
Nextcloud server installation with NGINX - Mageia wiki
/etc/nginx/nginx.conf : it is a global configuration file. Global parameters, which will apply to all web sites on the server, are set here....
Read more >
Nginx Configuration for Nextcloud - Roll Your Own Network
Nginx Configuration for Nextcloud · Secured HTTPS Server · Tor Onion Service · Unsecured HTTP Site and Aliases.
Read more >
nextcloud nginx config - gists · GitHub
nextcloud nginx config. GitHub Gist: instantly share code, notes, and snippets.
Read more >
Nextcloud Nginx SSL: Installation and Management - Bobcares
The next important step for installing Nextcloud with Nginx is Nextcloud includes an example Nginx configuration code.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found