“Not properly set up to resolve “/ocm-provider/” and “/ocs-provider/” on NGINX server

[Getting warnings - “Not properly set up to resolve “/ocm-provider/” and “/ocs-provider/” on NGINX server

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): Nextcloud Hub 4 (26.0.2)
Operating system and version (eg, Ubuntu 22.04): Ubuntu 22.04.2 LTS aarch64
Apache or nginx version (eg, Apache 2.4.25): nginx/1.21.4
PHP version (eg, 7.4): 8.1

The issue you are facing:
I’ve just installed NextCloud on a subdomain (cloud.techfliq.com) via cloudpanel and have encountered an issue. I am getting the following warnings, I tried couple of fix from forum but I feeling I am missing out something:

  • The web server is not properly configured to resolve the path “/ocm-provider/”. This is most likely due to the web server configuration not being updated to access this folder directly. Compare your configuration with the supplied Apache .htaccess rewrite rules or those provided in the Nginx documentation on the documentation page :arrow_upper_right:. Nginx usually needs to update the lines that start with “location ~”.

  • The web server is not properly configured to resolve the path “/ocs-provider/”. This is most likely due to the web server configuration not being updated to access this folder directly. Compare your configuration with the supplied Apache .htaccess rewrite rules or those provided in the Nginx documentation on the documentation page :arrow_upper_right:. Nginx usually needs to update the lines that start with “location ~”.

Is this the first time you’ve seen this error? (Y/N): Yes

The output of your Nextcloud log in Admin > Logging:

[PHP] Error: Using ${var} in strings is deprecated, use {$var} instead at /home/techfliq-cloud/htdocs/cloud.techfliq.com/3rdparty/scssphp/scssphp/src/Compiler.php#3491

GET /apps/theming/theme/light.css?plain=0&v=ddf4216d
from 172.69.33.83 by Aloysius at 2023-05-29T06:26:24+00:00

[PHP] Error: file_get_contents(/home/techfliq-cloud/htdocs/cloud.techfliq.com/.htaccess): Failed to open stream: No such file or directory at /home/techfliq-cloud/htdocs/cloud.techfliq.com/lib/private/Setup.php#515

POST /index.php
from 172.68.143.71 at 2023-05-29T06:26:15+00:00

The output of your config.php file in /home/techfliq-cloud/htdocs/cloud.techfliq.com/config :

<?php
$CONFIG = array (
  'instanceid' => 'xxxxxxx',
  'passwordsalt' => 'xxxxxxxxxxxxxxxxxx',
  'secret' => 'xxxxxxxxxxxxxxxxx',
  'trusted_domains' => 
  array (
    0 => 'cloud.techfliq.com',
  ),
  'datadirectory' => '/home/techfliq-cloud/htdocs/cloud.techfliq.com/data',
  'dbtype' => 'mysql',
  'version' => '26.0.2.1',
  'overwrite.cli.url' => 'https://cloud.techfliq.com',
  'dbname' => 'xxxxxxxxxx',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxxxxxxxxx',
  'dbpassword' => 'xxxxxxxxxxxx',
  'installed' => true,
);

My Config location: `/etc/nginx/sites-enabled/cloud.techfliq.com.conf:

server {
  listen 80;
  listen [::]:80;
  listen 443 ssl http2;
  listen [::]:443 ssl http2;
  ssl_certificate_key /etc/nginx/ssl-certificates/cloud.techfliq.com.key;
  ssl_certificate /etc/nginx/ssl-certificates/cloud.techfliq.com.crt;
  server_name cloud.techfliq.com;
  root /home/techfliq-cloud/htdocs/cloud.techfliq.com;

  access_log /home/techfliq-cloud/logs/nginx/access.log main;
  error_log /home/techfliq-cloud/logs/nginx/error.log;

  if ($scheme != "https") {
    rewrite ^ https://$host$uri permanent;
  }

  # set max upload size and increase upload timeout:
  client_max_body_size 512M;
  client_body_timeout 300s;
  fastcgi_buffers 64 4K;

  # Enable gzip but do not remove ETag headers
  gzip on;
  gzip_vary on;
  gzip_comp_level 4;
  gzip_min_length 256;
  gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
  gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;

  # Remove X-Powered-By, which is an information leak
  fastcgi_hide_header X-Powered-By;

  add_header Permissions-Policy "geolocation=(),midi=(),sync-xhr=(),microphone=(),camera=(),magnetometer=(),gyroscope=(),fullscreen=(self),payment=()";
  add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload;";

  location ^~ /.well-known {
    # The rules in this block are an adaptation of the rules
    # in `.htaccess` that concern `/.well-known`.
    location = /.well-known/carddav { return 301 /remote.php/dav/; }
    location = /.well-known/caldav  { return 301 /remote.php/dav/; }
    location /.well-known/acme-challenge    { try_files $uri $uri/ =404; }
    location /.well-known/pki-validation    { try_files $uri $uri/ =404; }

    # Let Nextcloud's API for `/.well-known` URIs handle all other
    # requests by passing them to the front-end controller.
    return 301 /index.php$request_uri;
    
  }
  
  # Remove "#" to enable the push service. Please note that this must be set up before activation.
  #location /push/ {
  #    proxy_pass http://localhost:7867/;
  #    proxy_http_version 1.1;
  #    proxy_set_header Upgrade $http_upgrade;
  #    proxy_set_header Connection "Upgrade";
  #    proxy_set_header Host $host;
  #    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  #}

  

  location / {
    rewrite ^ /index.php;
  }

  location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
    deny all;
  }

  location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
    deny all;
  }

  try_files $uri $uri/ /index.php?$args;
  index index.php index.html;

location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|oc[ms]-provider/.+|core/templates/40[34]).php(?:$|/) {
    include fastcgi_params;
    fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
    set $path_info $fastcgi_path_info;
    try_files $fastcgi_script_name =404;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $path_info;
    fastcgi_param front_controller_active true;
    fastcgi_read_timeout 3600;
    fastcgi_send_timeout 3600;
    fastcgi_pass 127.0.0.1:16001;
    fastcgi_param PHP_VALUE "
error_log=/home/techfliq-cloud/logs/php/error.log;
memory_limit=512M;
max_execution_time=60;
max_input_time=60;
max_input_vars=10000;
post_max_size=64M;
upload_max_filesize=64M;
date.timezone=UTC;
display_errors=off;";
  }

location ~ ^/(?:updater|oc[ms]-provider)(?:$|/) {
try_files $uri/ =301;
index index.php;
  }

  location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
    try_files $uri /index.php$request_uri;
    add_header Cache-Control "public, max-age=15778463";
    add_header X-Content-Type-Options nosniff;
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Robots-Tag none;
    add_header X-Download-Options noopen;
    add_header X-Permitted-Cross-Domain-Policies none;
    add_header Referrer-Policy no-referrer;
    # Optional: Don't log access to assets
    access_log off;
  }

  location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ {
    try_files $uri /index.php$request_uri;
    # Optional: Don't log access to other assets
    access_log off;
  }

  if (-f $request_filename) {
    break;
  }
}

What should I change in my nextcloud.conf to fix this issues?

Is it working with the default nginx template from the documentation?
https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html

yes, I tried the default nginx template but still those warnings appear

Can you open the link to the ocm-provider?

https://netcloud.example.com/ocm-provider/

You should get a JSON file…

I wasn’t getting a json file, but when I tried https://netcloud.example.com//ocm-provider/ I was able to get a json file…

Update : - I just reinstalled nextcloud with php 8.0 on cloudpanel now the issue is gone, seems like it was an issue with cloudpanel template with php 8.1. :sweat_smile:

Thanks for the support

What helped me was copying the ocm-provider and ocs-provider folders into the manually created ncloud folders. After this, the domain/ocs-provider/ page opened

Closer. I suppose I’ll look at copying folders around in nextcloud.
Should be a bug in this 27 version of that’s truly the root cause.

1 Like

Found a new .htaccess rule but not sure how this fits in with the nginx config. Seems the nginx config offered in the nextcloud docs is quite buggy.


  RewriteRule ^ocm-provider/?$ /index.php [QSA,L]

EDIT:
Found a fix. So you probably need to revert some fix you did in a previous version if there is this construction in your nginx config. Where there is:
oc[ms]
replace with
ocs

and restart nginx

Thanks, the oc[ms] did fix it in my case. I had to go line by line and fix errors in the sample subdir nginx config.
I did have to clear my browser cache in addition to restarting nginx or else the security & setup check still put up the warning.

@SQLSlacker which version are you on? Because I previously applied the change like you said (using oc[ms] ) for version 26 or 27.0.1 and now I had to revert to ocs (similar to the example config in nc docs) on 27.1.2 to make the error go away…

I’m using 27.1.2. try clearing your cache on whatever browser you use to check the warnings.

Seems ok using ocs even after clearing the cache from the browser and the php fcgi.
I’m also getting something that looks like valid output from mydomain.me/ocm-provider/ although I’m not sure what its good for exactly :grin: