Nginx location alias

Visiting https://mysite.local/v3.0 I’d like to serve folder /projects/src where Slim is. Now: nginx keeps appending v3.0 to the internal path. How can I avoid this? I’ve tried using alias:

server {
    listen 80;
    index index.php index.html;
    server_name mysite.local;
    root /projects/src;

    location /v3.0/ {
        alias /projects/src;
        try_files $uri /index.php$is_args$args;

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass php:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;

But this is not working as expected:

[error] 7#7: *3 open() "/projects/src/v3.0" failed (2: No such file or directory)

Could you please help me with this configuration for Slim (using version 3). Many thanks in advance.

Hi :slight_smile:

I’m not an expert but I would start by removing that “irregular” dot pattern on your path versioning to see if it helps. Replacing 3.0 by 3.

Dots on paths are normally an indication of a file not a path segment/directory.