Skip to content

Instantly share code, notes, and snippets.

@drmmr763
Last active June 15, 2018 11:35
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save drmmr763/747b9dc984faa58b6986 to your computer and use it in GitHub Desktop.
Save drmmr763/747b9dc984faa58b6986 to your computer and use it in GitHub Desktop.
mautic-symfony-nginx
server {
listen 80;
root /usr/share/nginx/html;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name _;
location / {
# try to serve file directly, fallback to app.php
try_files $uri /index.php$is_args$args;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on /tmp/php5-fpm.sock
#
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
### phpMyAdmin ###
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
client_max_body_size 4M;
client_body_buffer_size 128k;
try_files $uri =404;
root /usr/share/;
# Point it to the fpm socket;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)) {
root /usr/share/;
}
}
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}
### phpMyAdmin ###
}
@jeffersonmidei
Copy link

404 not found with mtracking.gif only. Everything else works.

How did you fix it, fevangelou?

@enmartinson
Copy link

enmartinson commented Aug 23, 2016

I was able to solve this by putting two lines in the server config:

location ~ mtc.js{
    try_files $uri /index.php?$args;
}
location ~ mtracking.gif{
      try_files $uri /index.php?$args;
}

Once that was in and I reloaded nginx it started working for me...

@droidlabour
Copy link

@enmartinson Awesome, Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment