EspoCRM fails to install

In order to help you, I need to know in more detail how you installed this application and which nginx files were auto-generated for it.

Thank you for your continued assistance.

I installed by clicking “install” in YunoHost

I went ahead and uninstalled and reinstalled and then pulled up the config. I can’t figure out how to copy text from the terminal so you just get screenshots, unfortunately:


This nginx conf file seems to be Ok. There’s another one : /etc/nginx/conf.d/<yourEspoCRMdomain>.conf
Could you check if mysql is running (webadmin => tools => services) and share the output of cat /etc/yunohost/apps/espocrm/settings.yml?

map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

server {
    listen 80;
    listen [::]:80;
    server_name [subdomain.domain.com];

    access_by_lua_file /usr/share/ssowat/access.lua;

    include /etc/nginx/conf.d/acme-challenge.conf.inc;

    location ^~ '/.well-known/ynh-diagnosis/' {
        alias /var/www/.well-known/ynh-diagnosis/;
    }


    location ^~ '/.well-known/autoconfig/mail/' {

app: espocrm
checksum__etc_cron.d_espocrm: 1c76b089447bd0c15ee2a7cc21e7f042
checksum__etc_nginx_conf.d_subdomain.domain.com.d_espocrm.conf: cc24b1bf038b94dd411e7ac989ab077e
checksum__etc_php_8.3_fpm_pool.d_espocrm.conf: 492c4ee0b8582c34f4a01eb0e3b7b909
current_revision: 965d7e333b3e73767603bd99d6193285ff33a725
db_name: espocrm
db_pwd: 3be7a8c93e6abc24175704cd
db_user: espocrm
domain: subdomain.domain.com
id: espocrm
install_dir: /var/www/espocrm
install_time: 1745788828
path: /
php_max_execution_time: '180'
php_max_input_time: '180'
php_memory_limit: 256M
php_post_max_size: 50M
php_upload_max_filesize: 50M
php_version: '8.3'

Check the MySQL logs and look for a domain name resolution or DNS issue. And test the subdomain and the domain name with dig (for example, dig example.com).

; <<>> DiG 9.18.33-1~deb12u2-Debian <<>> subdomain.domain.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8403
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;subdomain.domain.com.		IN	A

;; ANSWER SECTION:
subdomain.domain.com.	0	IN	A	127.0.0.1

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1) (UDP)
;; WHEN: Mon Apr 28 12:50:38 CDT 2025
;; MSG SIZE  rcvd: 66

Also the root domain I have like a dozen other services running on that all work fine.

Do these applications use a MySQL database?

And have you ever modified the /etc/hosts file on your Yunohost server?

[quote=“otm33, post:28, topic:36550”]
Do these applications use a MySQL database?
[/quote]

I’ve no idea. Currently I have installed (some not actively running but were functional when installed):

  • Castopod
  • Conduit
  • filebrowser
  • FreshRSS
  • Ghost
  • GoToSocial
  • Immich
  • JellyFin
  • Jitsi
  • LinkStack
  • NextCloud
  • Owncast
  • PeerTube
  • Syncthing
  • Ntfy

All of these are installed on the same root domain (different subdomains).

I don’t even know what that is, so have not and would not mess with it.

Again, I think this is a problem with the application itself, because I use the current nginx configuration to reach this error message. Which is why it’s so confusing. I’ve never had to install an app in Yunohost and then use the app to install the app again.

Well… I don’t know… I can install it multiple times without any problem.
Looks like this is turning into quite a puzzle… or missing something obvious ?

So you still get 1) the nginx-related error message (APIError) and then 2) the SQL-related error message?

I would check :

  • which installed applications are no longer working
  • if I can install other apps (apps with mysql database)
  • what do the two files created by nginx contain (before any modification) (/etc/nginx/conf.d/subdomain.domain.com.conf and /etc/nginx/conf.d/subdomain.domain.d/espocrm.conf)
  • how can I connect to mysql (outputs of mysql -h 127.0.0.1, mysql -h subdomain.domain.com, mysql -h localhost, mysql -h <local IP>)…

…I’m getting out of ideas for tonight…

Are you going through and completing the installation process after the installation process?

Yes

I don’t know anything about an SQL error message?

All of the other applications are working.

I posted this above.

Understandable. I appreciate the effort, regardless.




I mean before following these instructions:
image

Good to know it’s a me-issue I guess.

That php_network error was after I copied the code they gave me into the NGINX file. You see in the OP the only error I get after installation, the API error.

Yes, above I posted the default nginx config but I’ll post it again here:

/etc/nginx/conf.d/subdomain.domain.d/espocrm.conf

#sub_path_only rewrite ^/$ / permanent;
location / {

  # Path to source
  root /var/www/espocrm/public/;

  index index.html index.php;

  # Common parameter to increase upload size limit in conjunction with dedicated PHP-FPM file
  client_max_body_size 50M;

  try_files $uri $uri/ index.php;

  location ~ [^/]\.php(/|$) {
    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    fastcgi_pass unix:/var/run/php/php8.3-fpm-espocrm.sock;

    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param SCRIPT_FILENAME $request_filename;
  }

  location = /favicon.ico { access_log off; log_not_found off; }
  location = /robots.txt  { access_log off; log_not_found off; }

  location /client {
        root /var/www/espocrm/; # path to espocrm root dir
        autoindex off;

        location ~* ^.+\.(js|css|png|jpg|svg|svgz|jpeg|gif|ico|tpl)$ {
            access_log off;
            expires max;
        }
  }

  location /api/v1/ {
        if (!-e $request_filename){
            rewrite ^/api/v1/(.*)$ /api/v1/index.php last; break;
        }
    }

    location /portal/ {
        try_files $uri $uri/ /portal/index.php?$query_string;
    }

    location /api/v1/portal-access {
        if (!-e $request_filename){
            rewrite ^/api/v1/(.*)$ /api/v1/portal-access/index.php last; break;
        }
    }

    location ~ /(\.htaccess|\web.config|\.git) {
        deny all;
    }

    location ~ /reset/?$ {
        try_files /reset.html =404;
    }

    location ^~ /data/ {
        deny all;
    }

    location ^~ /application/ {
        deny all;
    }

location ^~ /custom/ {
        deny all;
    }

    location ^~ /vendor/ {
        deny all;
    }

    location ~ /\.ht {
        deny all;
    }
}

/etc/nginx/conf.d/subdomain.domain.d/espocrm.conf

map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

server {
    listen 80;
    listen [::]:80;
    server_name subdomain.domain.com;

    access_by_lua_file /usr/share/ssowat/access.lua;

    include /etc/nginx/conf.d/acme-challenge.conf.inc;

    location ^~ '/.well-known/ynh-diagnosis/' {
        alias /var/www/.well-known/ynh-diagnosis/;
    }


    location ^~ '/.well-known/autoconfig/mail/' {
        alias /var/www/.well-known/subdomain.domain.com/autoconfig/mail/;
    }




    location / {
        return 301 https://$host$request_uri;
    }



    include /etc/nginx/conf.d/yunohost_http_errors.conf.inc;

    access_log /var/log/nginx/subdomain.domain.com-access.log;
    error_log /var/log/nginx/subdomain.domain.com-error.log;
}

server {

    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name subdomain.domain.com;

    include /etc/nginx/conf.d/security.conf.inc;

    ssl_certificate /etc/yunohost/certs/subdomain.domain.com/crt.pem;
    ssl_certificate_key /etc/yunohost/certs/subdomain.domain.com/key.pem;


    more_set_headers "Strict-Transport-Security : max-age=63072000; includeSubDomains; preload";


    # OCSP settings
    ssl_stapling on;
    ssl_stapling_verify on;
    ssl_trusted_certificate /etc/yunohost/certs/subdomain.domain.com/crt.pem;
    resolver 1.1.1.1 9.9.9.9 valid=300s;
    resolver_timeout 5s;



    location ^~ '/.well-known/autoconfig/mail/' {
        alias /var/www/.well-known/subdomain.domain.com/autoconfig/mail/;
    }


location / {
        return 301 https://$host$request_uri;
    }



    include /etc/nginx/conf.d/yunohost_http_errors.conf.inc;

    access_log /var/log/nginx/subdomain.domain.com-access.log;
    error_log /var/log/nginx/subdomain.domain.com-error.log;
}

server {

    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name subdomain.domain.com;

    include /etc/nginx/conf.d/security.conf.inc;

    ssl_certificate /etc/yunohost/certs/subdomain.domain.com/crt.pem;
    ssl_certificate_key /etc/yunohost/certs/subdomain.domain.com/key.pem;


    more_set_headers "Strict-Transport-Security : max-age=63072000; includeSubDomains; preload";


    # OCSP settings
    ssl_stapling on;
    ssl_stapling_verify on;
    ssl_trusted_certificate /etc/yunohost/certs/subdomain.domain.com/crt.pem;
    resolver 1.1.1.1 9.9.9.9 valid=300s;
    resolver_timeout 5s;



    location ^~ '/.well-known/autoconfig/mail/' {
        alias /var/www/.well-known/subdomain.domain.com/autoconfig/mail/;
    }

yunohost tools regen-conf nginx --dry-run
Without much hope…
And check nginx log.

Nothing happened

There’s a whole lot of stuff in there about a domain I deleted a long time ago.

You have the server block for port 443 twice: is this a copy-paste error, or is it actually the case in the file?

Sorry, I don’t know what that means. What part is the “server block”?

I mean this block.

Hard to compare character-for-character but that looks right.

Something’s strange about espocrm in the log :

2025/04/25 17:23:50 [error] 345041#345041: *2526721 FastCGI sent in stderr: "PHP message: PHP Warning:  session_start(): open(/var/lib/php/sessions/sess_s3gfvukguc9h9g5rqlopt2l88o, O_RDWR) failed: Permission denied (13) in /var/www/espocrm/install/entry.php on line 37; PHP message: PHP Warning:  session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/espocrm/install/entry.php on line 37" while reading response header from upstream, 

What does the output of ls -ld /var/lib/php/sessions/ give?
What about installing other app?

drwx-wx-wt 2 root root 20480 May 2 12:47 /var/lib/php/sessions/

What other app?

What happened with the server block?