Skip to content

Apache server configuration for EspoCRM

These instructions are supplementary to the server configuration guidelines. Note that all configuration settings listed here are made on Ubuntu server.

PHP requirements

To install all necessary libraries, run these commands in the terminal:

sudo apt-get update
sudo apt-get install php-mysql php-json php-gd php-zip php-imap php-mbstring php-curl php-exif php-ldap
sudo phpenmod imap mbstring
sudo service apache2 restart

Fixing the issue 'API Error: EspoCRM API is unavailable'

When you are trying to install EspoCRM via browser, you may encounter 'API Error: EspoCRM API is unavailable' error.

To fix it, try the following steps one by one. After each step check if the issue is solved. If it works, then further steps are not needed.

1. Enable mod_rewrite support for Apache

To enable mod_rewrite, run these commands in a terminal:

sudo a2enmod rewrite
sudo service apache2 restart

2. Enable .htaccess support

To enable .htaccess support, add/edit the server configuration settings /etc/apache2/sites-available/ESPO_VIRTUAL_HOST.conf or /etc/apache2/apache2.conf (or /etc/httpd/conf/httpd.conf):

<Directory /PATH_TO_ESPO/>
AllowOverride All

You need to change /PATH_TO_ESPO/ to the full path to your EspoCRM inctance, e.g. /var/www/html/.

Afterward, restart apache:

sudo service apache2 restart

3. Add RewriteBase path (not needed in most cases)

Open the file /ESPOCRM_DIRECTORY/api/v1/.htaccess and replace the following line:

# RewriteBase /


RewriteBase /REQUEST_URI/api/v1/

where REQUEST_URI is a part of URL, e.g. for, REQUEST_URI is 'espocrm'.

Enable HTTP AUTHORIZATION support (only for FastCGI)

FastCGI does not support HTTP AUTHORIZATION by default. If you use FastCGI, you have to enable it in your VirtualHost or /etc/apache2/apache2.conf (or httpd.conf) by adding the following code:

For Fcgid module:

<IfModule mod_fcgid.c>
  FcgidPassHeader Authorization
  FcgidPassHeader Proxy-Authorization

For FastCgi module:

<IfModule mod_fastcgi.c>
   FastCgiConfig -pass-header Authorization \
                        -pass-header Proxy-Authorization \
                        -pass-header HTTP_AUTHORIZATION

To check which module is currently being used, run this command and find the module:

apache2ctl -M