Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Mautic Nginx Config (Install using Simple LNMP Installer - https://github.com/joglomedia/deploy) - Open Source Marketing Automation
server {
listen 80;
#listen [::]:80 default_server ipv6only=on;
## Make site accessible from world web.
server_name mautic.dev www.mautic.dev *.mautic.dev;
## Log Settings.
access_log /var/log/nginx/mautic.dev_access.log;
error_log /var/log/nginx/mautic.dev_error.log error;
#charset utf-8;
## Vhost root directory
set $root_path '/home/masedi/Webs/mautic.dev';
root $root_path;
index index.php index.html index.htm;
## Global directives configuration.
include /etc/nginx/conf.vhost/block.conf;
include /etc/nginx/conf.vhost/staticfiles.conf;
include /etc/nginx/conf.vhost/restrictions.conf;
## Default vhost directives configuration, use only one config.
#include /etc/nginx/conf.vhost/site_default.conf;
## MAUTIC CUSTOM DIRECTIVE SETTINGS ##
# redirect index.php to root
rewrite ^/index.php/(.*) /$1 permanent;
# 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; }
## Need modification, causing error 404
# 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 grunt, composer files
location ~* (Gruntfile|package|composer)\.(js|json)$ {
deny all;
access_log off;
log_not_found off;
}
## END OF MAUTIC SETTINGS ##
## pass the PHP scripts to php5-fpm
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
# Include FastCGI Params.
include /etc/nginx/fastcgi_params;
# Include FastCGI Configs.
include /etc/nginx/conf.vhost/fastcgi.conf;
# Uncomment to Enable PHP FastCGI cache.
#include /etc/nginx/conf.vhost/fastcgi_cache.conf;
# FastCGI socket, change to fits your own socket!
fastcgi_pass unix:/var/run/php5-fpm.masedi.sock;
}
## Uncomment to enable error page directives configuration.
#include /etc/nginx/conf.vhost/errorpage.conf;
## Add your custom site directives here.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.