The Lizmap documentation explains how to serve the webapp from root url which works well: Installation de Lizmap sous Linux Debian ou Ubuntu.
I was wondering how to configure Nginx to serve the app under a url subdirectory:
http://localhost/**lizmap**/index.php
In Apache it is working as expected:
Alias /lizmap "/var/www/html/lizmap/"
<Directory "/var/www/html/lizmap/">
Options +Indexes +FollowSymLinks +ExecCGI
AllowOverride All
Require all granted
</Directory>
Nginx doesn’t serve at http://localhost/**lizmap**/index.php with the following config trying to mirror Apache’s one:
location lizmap/ {
alias /var/www/html/lizmap;
index admin.php index.php;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
set $path_info $fastcgi_path_info; # because of bug http://trac.nginx.org/nginx/ticket/321
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
fastcgi_param PATH_TRANSLATED $document_root$path_info;
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
fastcgi_param SERVER_NAME $http_host;
}
}