Installing on NginX within a subfolder

Hello,



I’m trying to install Mautic on a webserver with Nginx BUT within a subfolder like: www.domain.com/mautic



Now I was trying to use the example from github https://gist.github.com/joglomedia/487c7c6a78892d2f1fd7 and came up with:

Code:
location ^~ /mautic { alias /var/www/domain.com/mautic; index index.php;
charset utf-8;

rewrite ^/index.php/(.*) /$1  permanent;

#######################################
##  Start Mautic Specific config #####
#######################################

# redirect some entire folders
rewrite ^/(vendor|translations|build)/.* /index.php break;


# Deny everything else in /app folder except Assets folder in bundles
location ~ /app/bundles/.*/Assets/ {
    allow all;
    access_log off;
}
location ~ /app/ { deny all; }

# Deny everything else in /addons or /plugins folder except Assets folder in bundles
location ~ /(addons|plugins)/.*/Assets/ {
    allow all;
    access_log off;
}
location ~ /(addons|plugins)/ { deny all; }

# Deny all php files in themes folder
location ~* ^/themes/(.*).php {
    deny all;
}


# Deny yml, twig, markdown, init file access
location ~* /(.*).(?:markdown|md|twig|yaml|yml|ht|htaccess|ini)$ {
    deny all;
    access_log off;
    log_not_found off;
}

# Deny all attempts to access hidden files/folders such as .htaccess, .htpasswd, .DS_Store (Mac), etc...
location ~ /. {
    deny all;
    access_log off;
    log_not_found off;
}

# Deny all grunt, composer files
location ~* (Gruntfile|package|composer).(js|json)$ {
    deny all;
    access_log off;
    log_not_found off;
}

#######################################
##  End Mautic Specific config #####
#######################################

    location ~ .php$ {
    fastcgi_split_path_info ^(.+.php)(/.+)$;

    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;

    fastcgi_buffer_size 128k;
    fastcgi_buffers 256 16k;
    fastcgi_busy_buffers_size 256k;
    fastcgi_temp_file_write_size 256k;
}

}


But on www.domain.com/mautic I receive a file called Download.
www.domain.com/mautic/index.php redirects to www.domain.com/mautic/index.php/index.php/installer
and the error log says: open() "/var/www/domain.com/mautic/index.php/index.php/installer" failed (20: Not a directory)
www.domain.com/mautic/index.php/installer just yields the error log entry: open() "/var/www/domain.com/mautic/index.php/installer" failed (20: Not a directory)

I assume there is some logic with the nested location for NginX wrong - but what can it be?

Hello,

I’m trying to install Mautic on a webserver with Nginx BUT within a subfolder like: www.domain.com/mautic

Now I was trying to use the example from github https://gist.github.com/joglomedia/487c7c6a78892d2f1fd7 and came up with:

[code]location ^~ /mautic {
alias /var/www/domain.com/mautic;
index index.php;

charset utf-8;

rewrite ^/index.php/(.*) /$1  permanent;

#######################################
##  Start Mautic Specific config #####
#######################################

# redirect some entire folders
rewrite ^/(vendor|translations|build)/.* /index.php break;


# Deny everything else in /app folder except Assets folder in bundles
location ~ /app/bundles/.*/Assets/ {
    allow all;
    access_log off;
}
location ~ /app/ { deny all; }

# Deny everything else in /addons or /plugins folder except Assets folder in bundles
location ~ /(addons|plugins)/.*/Assets/ {
    allow all;
    access_log off;
}
location ~ /(addons|plugins)/ { deny all; }

# Deny all php files in themes folder
location ~* ^/themes/(.*).php {
    deny all;
}


# Deny yml, twig, markdown, init file access
location ~* /(.*).(?:markdown|md|twig|yaml|yml|ht|htaccess|ini)$ {
    deny all;
    access_log off;
    log_not_found off;
}

# Deny all attempts to access hidden files/folders such as .htaccess, .htpasswd, .DS_Store (Mac), etc...
location ~ /. {
    deny all;
    access_log off;
    log_not_found off;
}

# Deny all grunt, composer files
location ~* (Gruntfile|package|composer).(js|json)$ {
    deny all;
    access_log off;
    log_not_found off;
}

#######################################
##  End Mautic Specific config #####
#######################################

    location ~ .php$ {
    fastcgi_split_path_info ^(.+.php)(/.+)$;

    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;

    fastcgi_buffer_size 128k;
    fastcgi_buffers 256 16k;
    fastcgi_busy_buffers_size 256k;
    fastcgi_temp_file_write_size 256k;
}

}
[/code]

But on www.domain.com/mautic I receive a file called Download.
www.domain.com/mautic/index.php redirects to www.domain.com/mautic/index.php/index.php/installer
and the error log says: open() “/var/www/domain.com/mautic/index.php/index.php/installer” failed (20: Not a directory)
www.domain.com/mautic/index.php/installer just yields the error log entry: open() “/var/www/domain.com/mautic/index.php/installer” failed (20: Not a directory)

I assume there is some logic with the nested location for NginX wrong - but what can it be?

Here is a second alternative config for NGINX: https://gist.github.com/that0n3guy/905c812c0f65e7ffb5ec