Mautic nginx config
5 March, 2021 by
Mautic nginx config
Administrator
# redirect some entire folders
rewrite ^/(vendor|translations|build)/.* /index.php break;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
# one option: try_files $uri $uri/ /index.php$is_args$args;
try_files $uri /index.php$is_args$args;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
# 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;
}
# Don’t log favicon
location = /favicon.ico {
log_not_found off;
access_log off;
}
# Don’t log robots
location = /robots.txt {
access_log off;
log_not_found off;
}
# 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;
}

 

 

https://gist.github.com/that0n3guy/905c812c0f65e7ffb5ec

 

In subdirectory pages

Thanks for your help.

I looked at your POST and I have seein that you have added the following lines into your nginx virtual host setup file:

————-
4) Edit your site’s server block.

The normal path is: /etc/nginx/sites-available/yoursite.com

location /pages {
try_files $uri $uri/ /pages/?q=$uri&$args;
}
————-

Did you only added this?
——
location /pages {
try_files $uri $uri/ /pages/?q=$uri&$args;
}
——

Is it enough to cover ALL Mautic needs to run on NGINX?
Or have you added any other lines? If so, could you please share?