Data directory accessible .htaccess file not working

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via 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:


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


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): 23.0.10
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.41
PHP version (eg, 7.4): 7.4

The issue you are facing:
Security warning:
Your data directory and files are probably accessible from the internet. The .htaccess file is not working. It is strongly recommended that you configure your web server so that the data directory is no longer accessible, or move the data directory outside the web server document root.

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

Steps to replicate it:

  1. Navigate to administration page in settings

The output of your Nextcloud log in Admin > Logging:

I have a ludicrous amount of log entries here. I need to know which items are useful for this problem.

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'instanceid' => '<redacted>',
  'passwordsalt' => '<redacted>',
  'secret' => '<redacted>',
  'trusted_domains' => 
  array (
    0 => '<redacted>',
    1 => '<redacted>',
    2 => '<redacted>',
    3 => '<redacted>',
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => '<redacted>',
  'dbname' => '<redacted>',
  'dbhost' => '<redacted>',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '<redacted>',
  'dbpassword' => '<redacted>',
  'installed' => true,
  'theme' => '',
  'loglevel' => 0,
  'maintenance' => false,
  'has_rebuilt_cache' => true,
  'app_install_overwrite' => 
  array (
    0 => 'spreed',
    1 => 'workflow_pdf_converter',
    2 => 'impersonate',
    3 => 'files_accesscontrol',
    4 => 'deck',
    5 => 'external',

The output of your Apache/nginx/system log in /var/log/____:

[Fri Oct 14 00:00:06.673938 2022] [ssl:warn] [pid 48395] AH01906: server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Fri Oct 14 00:00:06.673974 2022] [ssl:warn] [pid 48395] AH01909: server certificate does NOT include an ID which matches the server name
[Fri Oct 14 00:00:06.674043 2022] [ssl:error] [pid 48395] AH02217: ssl_stapling_init_cert: can't retrieve issuer certificate! [subject: CN=<redacted>,O=<redacted>,ST=<redacted>,C=<redacted> / issuer: CN=<redacted>,O=<redacted>,ST=<redacted>,C=<redacted> / serial: <redacted> / notbefore: Jun  7 03:59:02 2021 GMT / notafter: Jun  5 03:59:02 2031 GMT]
[Fri Oct 14 00:00:06.674047 2022] [ssl:error] [pid 48395] AH02604: Unable to configure certificate for stapling
[Fri Oct 14 00:00:06.674123 2022] [mpm_prefork:notice] [pid 48395] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Fri Oct 14 00:00:06.674176 2022] [core:notice] [pid 48395] AH00094: Command line: '/usr/sbin/apache2'

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.
CP\Http\Client\LocalServerException: Host violates local access rules
/var/www/nextcloud/lib/private/Http/Client/DnsPinMiddleware.php - line 136:
/var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php - line 35:
OC\Http\Client\DnsPinMiddleware->OC\Http\Client{closure}(“*** sensiti … “)
/var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php - line 31:
/var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/RedirectMiddleware.php - line 71:
** sensiti … “)
/var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php - line 63:
/var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/HandlerStack.php - line 75:
** sensiti … “)
/var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php - line 331:
/var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php - line 168:
/var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php - line 187:
/var/www/nextcloud/lib/private/Http/Client/Client.php - line 223:
/var/www/nextcloud/lib/private/Installer.php - line 296:
/var/www/nextcloud/lib/private/Installer.php - line 194:
/var/www/nextcloud/apps/settings/lib/Controller/AppSettingsController.php - line 536:
** sensiti … “)
/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 217:
** sensiti … *”)
/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 126:
/var/www/nextcloud/lib/private/AppFramework/App.php - line 157:
/var/www/nextcloud/lib/private/Route/Router.php - line 302:
/var/www/nextcloud/lib/base.php - line 1015:
/var/www/nextcloud/index.php - line 36:

I have tried every combination of "AllowOverride All" & "Satisfy Any" settings in both the /data/.htaccess file and the /etc/apache2/sites-available/nextcloud.conf file that re mentioned in every forum post and support article I could find. The warning still does not go away and I am still able to access files in the /data directory of other users than the one I am logged in as.

Hello @8jwd2ttdg3ft, ,

welcome to the community of Nextcloud.

Thanks for your post, but please take a little time to get acquainted with the forum and make a stronger effort to troubleshoot. It is the least you can do when asking others to help you:

  • Search your question as keywords on this forum. If you find something useful, link it directly into this post.
  • Search the internet using your issue as generic keywords. Specificity is king:
    • php modules missing Ubuntu Snap update
  • If you have an error message, repeat this process to search for your error on the forum and internet.
  • If you do not find an answer, you are likely using the wrong keywords. Try simplifying your search on the forum and internet even more.
    • nextcloud php modules missing
  • Once you’ve done this you should be able to edit and update your post with specific technical information we can use to help you.
  • Check Nextcloud admin documentation

Please edit and update your post to include:

  • Direct Links to any useful info pages, posts and other info you find.
  • Add screenshots to your post for context
  • If you have large log files to attach you can link to a pastebin
  • Fill out our support form and add into your post.

These are the exact same steps we volunteers will be following to help you! So, get to it!


I have tried the solutions provided or discussed on the following pages:






I have been trying many different combinations of locations (/data/.htaccess file & /etc/apache/sites-available/nextcloud.conf) and settings (“AllowOverride All” & “Satisfy Any”) mentioned in all of these pages for several hours. I apologize for the lack of specifics. My head is kind of mush at this point and I do not remember exactly which combinations I have tried. I began trying all manner of permutations with regard to these 2 settings and files because every source called one or both out.