Webserver Tips

PHP safe mode

PHP safe mode has to be turned off. It is deprecated and has been removed in newer PHP versions. Verify its status with PHP Version and Information, and look for safe_mode on/off. If it is on, then add this line to php.ini to turn it off:

safe_mode = Off

Raise max_file_uploads of PHP

The PHP setting max_file_uploads within the php.ini defaults to 20 on most environments which allows that number of simultaneous uploads. Currently the ownCloud sync client is doing 3 parallel uploads which means that at least 6 clients can upload files simultaneously. Depending on your server usage it is recommended to raise this number to a higher value.

Enable the SPDY / http_v2 protocol

Your webserver can be configured to use the SPDY / http_v2 protocol which could improve the overall performance of ownCloud. Please have a look at the documentation of your webservers module for more information:

Note

If you want to enable SPDY for Apache please note the Known Issues of this module to avoid problems after enabling it.

Note

If you want to use http_v2 for nginx you have to check two things:

1.) be aware that this module is not built in by default due to a dependency to the openssl version used on your system. It will be enabled with the --with-http_v2_module configuration parameter during compilation. The dependency should be checked automatically. You can check the presence of http_v2 with nginx -V 2>&1 | grep http_v2 -o. An example how to compile nginx can be found in section “Configure Nginx with the nginx-cache-purge module” below.

2.) When you have used SPDY before, the nginx config has to be changed from listen 443 ssl spdy; to listen 443 ssl http2;

Apache Tuning

Maximum number of Apache processes

An Apache process uses around 12MB of RAM. Apache should be configured so that the maximum number of HTTPD processes times 12MB is lower than the amount of RAM. Otherwise the system begins to swap and the performance goes down.

KeepAlive should be configured with sensible defaults

The KeepAlive directive enables persistent HTTP connections, allowing multiple requests to be sent over the same TCP connection. This reduces latency by as much as 50%. Especially in combination with the periodic checks of the sync client the following settings are recommended:

KeepAlive On
KeepAliveTimeout 100
MaxKeepAliveRequests 200

mod_gzip

mod_gzip should be used because it speeds up the transfer of data and helps to free server memory, and HTTP connections are closed faster.

MPM

Apache prefork has to be used. Don’t use threaded mpm with mod_php because PHP is currently not thread safe.

Hostname Lookups

# cat /etc/httpd/conf/httpd.conf
...
HostnameLookups off

Log files

Log files should be switched off for maximum performance.

Comment out the CustomLog directive. Keep ErrorLog to be able to track down errors.