summarylogtreecommitdiffstats
path: root/nginx.conf.example
blob: 6031fcdbed7dcc828aa8d4b3a9b528d317a4c61d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
server {
        server_name     dolibarr.localdomain;

        root    /usr/share/webapps/dolibarr/htdocs;
        index   index.php;

        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:/run/php-fpm/php-fpm.sock;
                fastcgi_index  index.php;
                include        fastcgi.conf;
                fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;

                # Dolibarr Rest API path support
                fastcgi_param  PATH_INFO       $fastcgi_path_info;
                fastcgi_param  PATH_TRANSLATED $document_root$fastcgi_script_name;
                fastcgi_read_timeout 300;
        }

        # Pretty REST API URL
        location ~ ^/api/(?!(index\.php))(.*) {
                try_files $uri /api/index.php/$2?$query_string;
        }
}