Announcement

Collapse
No announcement yet.

Installing EspoCRM on a Hostinger VPS with Ubuntu OS and Nginx : Error espocrm-php

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Installing EspoCRM on a Hostinger VPS with Ubuntu OS and Nginx : Error espocrm-php

    Hi,

    I am installing EspoCRM on my Hostinger VPS that has an Ubuntu OS and Nginx. I followed the steps on the pages below.




    I was able to create an espocrm.conf in /etc/nginx/sites-available/ and replaced the path to public dir and espocrm root dir as follows

    Code:
    root /home/mycontrols/htdocs/mydomain.net/crm/public; # path to public dir
    root /home/mycontrols/htdocs/mydomain.net/crm/; # path to espocrm root dir
    I also removed the lines below because it is giving me the error when I run sudo nginx -t : [emerg] a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/espocrm.conf. Maybe because I already have the same stanza in mydomain.net.conf.

    Code:
    listen 80 default_server;
    listen [::]:80 default_server;


    I then run the command below in putty to create a symbolic link.

    Code:
    sudo ln -s /etc/nginx/sites-available/espocrm.conf /etc/nginx/sites-enabled/
    Then I tried running the command below but it is giving me the error host not found in upstream "espocrm-php" in /etc/nginx/sites-enabled/espocrm.conf
    Code:
    sudo nginx -t


    I am currently stuck with this and couldn't proceed with the installation. Hoping that someone will help me figure out what i did wrong.

    Thanks in advance...

  • #2
    Just an update, i replaced the directive fastcgi_pass espocrm-php:9000; to fastcgi_pass 127.0.0.1:{{php_fpm_port}};

    I no longer encounter the error host not found in upstream "espocrm-php" in /etc/nginx/sites-enabled/espocrm.conf

    However, when I try to access my espoCRM url https://mydomain.net/crm/​ it gives me the error in the image below

    Click image for larger version

Name:	image.png
Views:	330
Size:	15.7 KB
ID:	106462

    Comment


    • yuri
      yuri commented
      Editing a comment
      This is normal when this page is shown. Just an information to configure the web server.

  • #3
    Hi Everyone, just an update. I was able to successfully install Espo CRM up to the end where it shows that cron that needs to be set. Below is the Config file that I have in my CloudPanel vHost

    Code:
    server {
      listen 80;
      listen [::]:80;
      listen 443 ssl http2;
      listen [::]:443 ssl http2;
      {{ssl_certificate_key}}
      {{ssl_certificate}}
      server_name crm.mysite.net;
      #{{root}}
      root /home/icon-crm/htdocs/crm.mysite.net/public;
    
      {{nginx_access_log}}
      {{nginx_error_log}}
    
      if ($scheme != "https") {
        rewrite ^ https://$host$uri permanent;
      }
    
      location ~ /.well-known {
        auth_basic off;
        allow all;
      }
    
      {{settings}}
    
      location / {
        {{varnish_proxy_pass}}
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_hide_header X-Varnish;
        proxy_redirect off;
        proxy_max_temp_file_size 0;
        proxy_connect_timeout      720;
        proxy_send_timeout         720;
        proxy_read_timeout         720;
        proxy_buffer_size          128k;
        proxy_buffers              4 256k;
        proxy_busy_buffers_size    256k;
        proxy_temp_file_write_size 256k;
      }
    
      location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|woff2|eot|mp4|ogg|ogv|webm|webp|zip|swf|map)$ {
        add_header Access-Control-Allow-Origin "*";
        expires max;
        access_log off;
      }
    
      if (-f $request_filename) {
        break;
      }
    }
    
    server {
      listen 8080;
      listen [::]:8080;
      server_name crm.mysite.net;
      #{{root}}
      root /home/icon-crm/htdocs/crm.mysite.net/public; 
    
      try_files $uri $uri/ /index.php?$args;
      index index.php index.html;
    
      location ~ \.php$ {
        include fastcgi_params;
        fastcgi_intercept_errors on;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        try_files $uri =404;
        fastcgi_read_timeout 3600;
        fastcgi_send_timeout 3600;
        fastcgi_param HTTPS "on";
        fastcgi_param SERVER_PORT 443;
        fastcgi_pass 127.0.0.1:{{php_fpm_port}};
        fastcgi_param PHP_VALUE "{{php_settings}}";
      }
    
      if (-f $request_filename) {
        break;
      }
    }
    
    #Start of EspoCRM Block*************************************************************
    
    server {
        listen 80;
        listen [::]:80;
        
        server_name crm.mysite.net; # domain name
        charset utf-8;
        index index.html index.php;
        client_max_body_size 50M;
        keepalive_timeout 300;
        types_hash_max_size 2048;
    
        server_tokens off;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
    
        gzip on;
        gzip_types text/plain text/css text/javascript application/javascript application/json;
        gzip_min_length 1000;
        gzip_comp_level 9;
    
    
        root /home/icon-crm/htdocs/crm.mysite.net/public; # path to public dir
          
        location /client {
            root /home/icon-crm/htdocs/crm.mysite.net/; # path to espocrm root dir
            autoindex off;
    
            location ~* ^.+.(js|css|png|jpg|svg|svgz|jpeg|gif|ico|tpl)$ {
                access_log off;
                expires max;
            }
        }
    
        location = /favicon.ico { access_log off; log_not_found off; }
        location = /robots.txt  { access_log off; log_not_found off; }
    
        location ~ \.php$ {
            fastcgi_pass 127.0.0.1:9000;
            include fastcgi_params;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param QUERY_STRING $query_string;
        }
    
        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;
        }
    }​

    However, when I click the button that says proceed to EspoCRM or visit my url https://crm.mysite.com/ it is giving me the error Bad Server Reponse. There are 6 errors in total, below is the screenshot of the first error.

    Click image for larger version  Name:	image.png Views:	0 Size:	43.0 KB ID:	106564
    I think the error has something to do with how I defined the root directive. yuri or anyone, please help on how I can resolve this.

    Thanks...
    Last edited by Triggerz; 05-26-2024, 06:43 AM.

    Comment


    • #4
      Bad server responses should be checked in the backend (espo logs, webserver logs).

      Comment


      • Triggerz
        Triggerz commented
        Editing a comment
        Thanks yuri. I see that one of the error is that it is looking for the /client/lib/original/espo-crm.js file

        I saw the post below that talks about the same issue
        Hi, i don't know if it's important but this file is missing ing V8.0.x : client/lib/original/espo-main.js /Downloads/EspoCRM-8.0.1/client/lib/espo-main.js.map: 1: {"version":3,"file":"espo-main.js","sources":["original/espo-main.js"],... the result is in browser : Could not


        Can you direct me on where I can get this file?

        Also, when I tested to install Espo CRM in a shared hosting in hostgator, I was able to install it successfully and it was not looking for the espo-crm.js file. Just curious on why when installed in Nginx it is looking for this file? Thanks
        Last edited by Triggerz; 05-24-2024, 12:40 PM.

    • #5
      I've been trying to figure this out for 2 weeks already and I still couldn't figure out how to resolve the issue
      I hope someone can help me with the solution.

      Thanks

      Comment

      Working...
      X