SuiteCRM v8.0 nginx config

@ Lyk37858 I am evaluating suiteCRM with nginx, this is something that is working for us with SuiteCRM version 8.0.

Basically, there is a special case for /api/ and everything is either tested for existence (so it gets sent by nginx) or forced through /index.php over fastcgi if necessary.

        location ~ ^/api/ {
            index index.php;
            try_files $uri @rewrite_api;
        }
        location / {
            index index.php;
            try_files $uri @rewrite_ep;
        }
        location ~ [^/]\.php(/.*)?$ {
            fastcgi_split_path_info ^(.+\.php)(/.*)$;
            if (!-f $document_root$fastcgi_script_name) {
                return 404;
            }

            # Mitigate https://httpoxy.org/ vulnerabilities
            fastcgi_param HTTP_PROXY "";

            fastcgi_pass   unix:/var/run/php-fpm.sock;
            fastcgi_index  index.php;
            include        fastcgi_params;
            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO       $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED $document_root$fastcgi_script_name;
            fastcgi_param  PHP_SELF $document_root$fastcgi_script_name;
        }
        location @rewrite_api {
            rewrite ^/api/(.*)$ /index.php/$1 last;
        }
        location @rewrite_ep {
            rewrite ^/(.*)$ /index.php/$1 last;
        }

1 Like

Hi @evilham, welcome to the Community :tada:

Is that a configuration for the v8 API in SuiteCRM 7.x, or is that for SuiteCRM v8?

SuiteCRM v8, updated accordingly.

Hi @evilham,

Welcome to the community :wave: Thank you for sharing!

The following post could be of interest:

Thanks for clarifying @evilham.

I moved this to a new topic, to avoid confusion. Thanks for sharing your config.

That’s much more complete, it’s great that these are now linked :-). Thank you!

any feed on this? any benefit on replacing apache with nginx? (it should)

Nginx has superior performance when serving static content
it does this by directly using the sendfile kernel system call.
Nginx also uses an event-driven, asynchronous architecture where Apache will start a new process for each connection.

Personally I also find it much easier to understand with its configuration looking more like English rather than hieroglyphs

You’re correct!

Nginx is best :100:

https://nginx.org/