Accessing Nextcloud from outside network is extremely slow

[/details]

Nextcloud version: 21.0.1
Operating system and version : Ubuntu 20.04
Apache or nginx: Apache
PHP version : 7.4

The issue you are facing:

It’s basicallly just extremely slow (i.e. 3-5 minutes) to load any page when I try to access from outside of my network. Login page, dashboard, settings, etc… every page takes such a long time. This includes using my domain or my external IP address, so I don’t think it can be the ssl encryption. When accessing from inside the network via the local IP, it’s great. Extremely fast.

Is this the first time you’ve seen this error?:

Yes, I did a bunch of different work before it happened, including an attempt to install onlyoffice on the same server with nginx, and porting all of my files from my other server over and using “group folders.” I completely removed nginx and onlyoffice to the best of my knowledge. I don’t know if these things are related but I figured I should include them.

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

<?php                                                                                                                                                                                                                                                                        
$CONFIG = array (                                                                                                                                                                                                                                                              
'instanceid' => 'blahblah',                                                                                                                                                                                                                                              
'passwordsalt' => 'blahblah',                                                                                                                                                                                                                          
'secret' => 'blahblah',                                                                                                                                                                                                              
'trusted_domains' =>                                                                                                                                                                                                                                                         
array (                                                                                                                                                                                                                                                                        
0 => 'LOCALIP',                                                                                                                                                                                                                                                        
1 => 'servername.org',                                                                                                                                                                                                                                           
2 => 'www.servername.org',                                                                                                                                                                                                                                       
3 => 'EXTERNALIP'                                                                                                                                                                                                                                                       
),                                                                                                                                                                                                                                                                           
'datadirectory' => '/var/www/nextcloud/data',                                                                                                                                                                                                                                
'dbtype' => 'mysql',                                                                                                                                                                                                                                                         
'version' => '21.0.1.1',                                                                                                                                                                                                                                                     
'overwrite.cli.url' => 'https://LOCALIP/nextcloud',                                                                                                                                                                                                                    
'dbname' => 'nextcloud',                                                                                                                                                                                                                                                     
'dbhost' => 'localhost',                                                                                                                                                                                                                                                     
'dbport' => '',                                                                                                                                                                                                                                                              
'dbtableprefix' => 'oc_',                                                                                                                                                                                                                                                    
'mysql.utf8mb4' => true,                                                                                                                                                                                                                                                     
'dbuser' => 'username',                                                                                                                                                                                                                                                       
'dbpassword' => 'password',                                                                                                                                                                                                                                           
'installed' => true,                                                                                                                                                                                                                                                         
'auth.bruteforce.protection.enabled' => false,                                                                                                                                                                                                                               
'default_phone_region' => 'US',                                                                                                                                                                                                                                              
'memcache.local' => '\\OC\\Memcache\\APCu',                                                                                                                                                                                                                                  
'mail_from_address' => 'tanner',                                                                                                                                                                                                                                             
'mail_smtpmode' => 'smtp',                                                                                                                                                                                                                                                   
'mail_sendmailmode' => 'smtp',                                                                                                                                                                                                                                               
'mail_domain' => 'gmail.com',                                                                                                                                                                                                                                            
'mail_smtpauthtype' => 'LOGIN',                                                                                                                                                                                                                                              
'mail_smtpauth' => 1,                                                                                                                                                                                                                                                        
'mail_smtphost' => 'smtp.gmail.com',                                                                                                                                                                                                                                         
'mail_smtpport' => '465',                                                                                                                                                                                                                                                    
'mail_smtpname' => 'email@mail.com',                                                                                                                                                                                                                                    
'mail_smtppassword' => 'Password',                                                                                                                                                                                                                                         
'mail_smtpsecure' => 'ssl',                                                                                                                                                                                                                                                  
'maintenance' => false,                                                                                                                                                                                                                                                    
);      

What I’ve tried:

  • I’ve done a lot of researching. I’ve tried the files:scan thing because I notice the cron.php was hanging when trying to load the page. I also tried to delete the content of oc_jobs for the same reason.
  • I’ve configured over and over again the files in /var/www/nextcloud/config and /etc/apache2/sites-available

Apps Installed

Enabled:                                                                                                                                                                                                                                                                      
- accessibility: 1.7.0                                                                                                                                                                                                                                                       
- activity: 2.14.3                                                                                                                                                                                                                                                           
- breezedark: 21.0.7                                                                                                                                                                                                                                                         
- calendar: 2.2.0                                                                                                                                                                                                                                                            
- cloud_federation_api: 1.4.0                                                                                                                                                                                                                                                
- comments: 1.11.0                                                                                                                                                                                                                                                           
- contactsinteraction: 1.2.0                                                                                                                                                                                                                                                 
- dashboard: 7.1.0                                                                                                                                                                                                                                                           
- dav: 1.17.1                                                                                                                                                                                                                                                                
- deck: 1.4.1                                                                                                                                                                                                                                                                
- federatedfilesharing: 1.11.0                                                                                                                                                                                                                                               
- federation: 1.11.0                                                                                                                                                                                                                                                         
- files: 1.16.0                                                                                                                                                                                                                                                              
- files_external: 1.12.0                                                                                                                                                                                                                                                     
- files_pdfviewer: 2.1.0                                                                                                                                                                                                                                                     
- files_rightclick: 1.0.0                                                                                                                                                                                                                                                    
- files_sharing: 1.13.1                                                                                                                                                                                                                                                      
- files_trashbin: 1.11.0                                                                                                                                                                                                                                                     
- files_versions: 1.14.0                                                                                                                                                                                                                                                     
- files_videoplayer: 1.10.0                                                                                                                                                                                                                                                  
- firstrunwizard: 2.10.0                                                                                                                                                                                                                                                     
- groupfolders: 9.0.0                                                                                                                                                                                                                                                        
- logreader: 2.6.0                                                                                                                                                                                                                                                           
- lookup_server_connector: 1.9.0                                                                                                                                                                                                                                             
- mail: 1.9.5                                                                                                                                                                                                                                                                
- nextcloud_announcements: 1.10.0                                                                                                                                                                                                                                            
- notifications: 2.9.0                                                                                                                                                                                                                                                       
- oauth2: 1.9.0                                                                                                                                                                                                                                                              
- password_policy: 1.11.0                                                                                                                                                                                                                                                    
- photos: 1.3.0                                                                                                                                                                                                                                                              
- privacy: 1.5.0                                                                                                                                                                                                                                                             
- provisioning_api: 1.11.0                                                                                                                                                                                                                                                   
- recommendations: 1.0.0                                                                                                                                                                                                                                                     
- registration: 1.2.1                                                                                                                                                                                                                                                        
- richdocuments: 4.0.4                                                                                                                                                                                                                                                       
- richdocumentscode: 6.4.705                                                                                                                                                                                                                                                 
- serverinfo: 1.11.0                                                                                                                                                                                                                                                         
- settings: 1.3.0                                                                                                                                                                                                                                                            
- sharebymail: 1.11.0                                                                                                                                                                                                                                                        
- spreed: 11.1.2                                                                                                                                                                                                                                                             
- support: 1.4.0                                                                                                                                                                                                                                                             
- survey_client: 1.9.0                                                                                                                                                                                                                                                       
- systemtags: 1.11.0                                                                                                                                                                                                                                                         
- text: 3.2.0                                                                                                                                                                                                                                                                
- theming: 1.12.0                                                                                                                                                                                                                                                            
- twofactor_backupcodes: 1.10.0                                                                                                                                                                                                                                              
- updatenotification: 1.11.0                                                                                                                                                                                                                                                 
- user_status: 1.1.1                                                                                                                                                                                                                                                         
- viewer: 1.5.0                                                                                                                                                                                                                                                              
- weather_status: 1.1.0                                                                                                                                                                                                                                                      
- workflowengine: 2.3.0                                                                                                                                                                                                                                                    
Disabled:                                                                                                                                                                                                                                                                      
- admin_audit                                                                                                                                                                                                                                                                
- bruteforcesettings                                                                                                                                                                                                                                                         
- encryption                                                                                                                                                                                                                                                                 
- user_ldap  

Hi, could you please post which apps are installed and your nextcloud&apache log?

I added my apps installed to my original post. I’ll post the logs below.

Apache2 Error Log

[Mon Apr 26 00:00:01.397535 2021] [mpm_prefork:notice] [pid 9356] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations                                                                                                                    
[Mon Apr 26 00:00:01.397562 2021] [core:notice] [pid 9356] AH00094: Command line: '/usr/sbin/apache2'                                                                                                                                                                        
[Mon Apr 26 07:16:28.650204 2021] [access_compat:error] [pid 302669] [client 192.168.1.155:56686] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata                                                                                            
[Mon Apr 26 09:01:39.242020 2021] [mpm_prefork:notice] [pid 9356] AH00169: caught SIGTERM, shutting down                                                                                                                                                                     
[Mon Apr 26 09:01:39.332889 2021] [mpm_prefork:notice] [pid 922346] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations                                                                                                                  
[Mon Apr 26 09:01:39.332932 2021] [core:notice] [pid 922346] AH00094: Command line: '/usr/sbin/apache2'                                                                                                                                                                      
[Mon Apr 26 09:03:28.148754 2021] [mpm_prefork:notice] [pid 922346] AH00169: caught SIGTERM, shutting down                                                                                                                                                                   
[Mon Apr 26 09:03:28.236748 2021] [mpm_prefork:notice] [pid 924450] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations                                                                                                                  
[Mon Apr 26 09:03:28.236798 2021] [core:notice] [pid 924450] AH00094: Command line: '/usr/sbin/apache2'                                                                                                                                                                      
[Mon Apr 26 09:10:24.147894 2021] [mpm_prefork:notice] [pid 924450] AH00169: caught SIGTERM, shutting down                                                                                                                                                                   
[Mon Apr 26 09:10:24.241934 2021] [mpm_prefork:notice] [pid 932377] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations                                                                                                                  
[Mon Apr 26 09:10:24.242003 2021] [core:notice] [pid 932377] AH00094: Command line: '/usr/sbin/apache2'                                                                                                                                                                                                                                                                                                                                                                                                                                                   
Logging at warning level to file: /tmp/loolwsd.8ux9PNm2lk/loolwsd.log                                                                                                                                                                                                        
Security: loolforkit incorrect user-name, other than 'lool'                                                                                                                                                                                                                  
Security: Check for the 'lool' username overridden on the command line.                                                                                                                                                                                                      
Init vcl                                                                                                                                                                                                                                                                     
preload: merged unordf ucpchelp1 msforms vbaobj pcr vbaswobj sw animcore hwp flash chartcore solver sc wpftcalc xof ucpcmis1 wpftdraw sd svgfilter evtatt graphicfilter wpftimpress sdfilt sm pdffilter PresentationMinimizer protocolhandler ucpdav1 wpftwriter msword writ> emfio vbaevents pdfimport mysql_jdbc ucpext hyphen spell lnth for ctl passwordcontainer svgio                                                                                                                                                                               
Absent (often optional): sm sm sm sm sm sm sm sm sm sm sm smd                                                                                                                                                                                                                
Disabled: ucpftp1 rptxml dbu rptui rpt mork odbc sdbc2 cmdmail syssh ucphier1 ucpimage PresenterScreen abp dbp updatefeed                                                                                                                                                    
Whitelisted languages: de_DE el en_GB en_US es_ES fr_FR hu it nl pt_BR pt_PT ru                                                                                                                                                                                              
Preloading dictionaries: de_DE en_US fr_FR it_IT nl_NL pt_BR ru_RU en_GB nl_BE pt_PT es_ES                                                                                                                                                                                   
Preloading thesauri: de_DE en_US fr_FR it_IT nl_NL pt_BR ru_RU en_GB nl_BE pt_PT es_ES                                                                                                                                                                                       
Preload icons                                                                                                                                                                                                                                                                
Preload languages                                                                                                                                                                                                                                                            
Preload fonts                                                                                                                                                                                                                                                                
[Mon Apr 26 09:13:53.115529 2021] [php7:warn] [pid 932635] [client 192.168.1.155:55430] PHP Warning:  file_get_contents(http://localhost:9983/hosting/capabilities): failed to open stream: HTTP request failed! in /var/www/nextcloud/apps/richdocumentscode/proxy.php on l>Ready to accept connections on port 9983.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
Security: loolmount incorrect user-name, other than 'lool'                                                                                                                                                                                                                   
Aborting.                                                                                                                                                                                                                                                                    
Security: loolmount incorrect user-name, other than 'lool'                                                                                                                                                                                                                   
Aborting.                                                                                                                                                                                                                                                                    
Security: loolmount incorrect user-name, other than 'lool'                                                                                                                                                                                                                   
Aborting.                                                                                                                                                                                                                                                                    
[Mon Apr 26 09:13:58.924695 2021] [php7:notice] [pid 932398] [client 192.168.1.155:55597] richdocumentscode (proxy.php) error exit, PID: 932398, Message: No content in reply from loolwsd. Is SSL enabled in error ?                                                        wsd-932755-932755 2021-04-26 15:17:27.282862 [ loolwsd ] SIG  frk-932765-932765 2021-04-26 15:17:27.282871 [ forkit ] SIG  kit-932775-932765 2021-04-26 15:17:27.282881 [ kit_spare_002 ] SIG   Shutdown signal received:  Shutdown signal received:  Shutdown signal receiv>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          wsd-932755-932755 2021-04-26 15:17:27.307528 [ loolwsd ] SIG   Forced-Termination signal received: SIGTERM                                                                                                                                                                   
sh: 1: /tmp/.mount_Collab89CXX8/usr/bin/loolmount: not found                                                                                                                                                                                                                 
sh: 1: /tmp/.mount_Collab89CXX8/usr/bin/loolmount: not found                                                                                                                                                                                                                 
[Mon Apr 26 09:17:27.347405 2021] [mpm_prefork:notice] [pid 932377] AH00169: caught SIGTERM, shutting down                                                                                                                                                                   
[Mon Apr 26 09:17:27.438591 2021] [mpm_prefork:notice] [pid 933222] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations                                                                                                                  
[Mon Apr 26 09:17:27.438676 2021] [core:notice] [pid 933222] AH00094: Command line: '/usr/sbin/apache2'                                                                                                                                                                      
[Mon Apr 26 09:17:40.683585 2021] [mpm_prefork:notice] [pid 933222] AH00169: caught SIGTERM, shutting down                                                                                                                                                                   
[Mon Apr 26 09:18:18.204288 2021] [mpm_prefork:notice] [pid 1319] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations                                                                                                                    
[Mon Apr 26 09:18:18.204497 2021] [core:notice] [pid 1319] AH00094: Command line: '/usr/sbin/apache2'                                                                                                                                                                        
[Mon Apr 26 09:28:41.769058 2021] [mpm_prefork:notice] [pid 1319] AH00169: caught SIGTERM, shutting down                                                                                                                                                                     
[Mon Apr 26 09:28:41.848890 2021] [mpm_prefork:notice] [pid 3374] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations                                                                                                                    
[Mon Apr 26 09:28:41.848932 2021] [core:notice] [pid 3374] AH00094: Command line: '/usr/sbin/apache2'                                                                                                                                                                        
[Mon Apr 26 09:30:11.682132 2021] [mpm_prefork:notice] [pid 3374] AH00169: caught SIGTERM, shutting down                                                                                                                                                                     
[Mon Apr 26 09:30:11.761584 2021] [mpm_prefork:notice] [pid 3471] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations                                                                                                                    
[Mon Apr 26 09:30:11.761635 2021] [core:notice] [pid 3471] AH00094: Command line: '/usr/sbin/apache2'                                                                                                                                                                        
[Mon Apr 26 09:30:13.424605 2021] [mpm_prefork:notice] [pid 3471] AH00169: caught SIGTERM, shutting down                                                                                                                                                                     
[Mon Apr 26 09:30:13.502490 2021] [mpm_prefork:notice] [pid 3489] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations                                                                                                                    
[Mon Apr 26 09:30:13.502535 2021] [core:notice] [pid 3489] AH00094: Command line: '/usr/sbin/apache2'                                                                                                                                                                        
[Mon Apr 26 09:53:29.602194 2021] [access_compat:error] [pid 3555] [client 192.168.1.155:57236] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata                                                                                              
[Mon Apr 26 10:11:10.371243 2021] [access_compat:error] [pid 5226] [client 192.168.1.155:57432] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata                                                                                              
[Mon Apr 26 10:29:08.491658 2021] [access_compat:error] [pid 3616] [client 172.56.41.119:35209] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata   

Thanks! I see that richdocumentscode is installed. You could try to disable this app. Maybe it solves your problem already. See RichDocuments built-in CODE causes significant slowdown/timeout issues · Issue #1282 · nextcloud/richdocuments · GitHub

I tried that, but it’s still extremely slow. I finally pulled up the Overview page from outside the network and got this.

It’s weird because it gives me a green check when I access it from inside the network.

It looks like you are using nginx in between your Nextcloud and the outside internet. Is that the case?
If yes, please make sure that it is correctly configured based on the manual: Nginx configuration — Nextcloud latest Administration Manual latest documentation Reverse proxy — Nextcloud latest Administration Manual latest documentation

No, I’m not. I’m using apache. I installed nginx by mistake afterwards but then tried to uninstall it the best I could.

I guess in this case is the most easiest way to restore a backup to the point where you’ve started tinkering with your system or start over with a clean system.

If that isn’t possible, I’d recommend to purge nginx e.g. by running

sudo apt purge nginx
sudo apt autoremove
sudo reboot

Then you could try again.

I gave it a shot. It’s rebooting now.

It seems to be working now! Thanks for your help.

1 Like

Sorry, I thought it wasn’t working at first, but then it started working great. I think I just needed to purge the nginx files like you were saying. Works fantastic now!

1 Like