Last active
June 15, 2018 11:35
-
-
Save drmmr763/747b9dc984faa58b6986 to your computer and use it in GitHub Desktop.
mautic-symfony-nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ### | |
} |
404 not found with mtracking.gif only. Everything else works.
404 not found with mtracking.gif only. Everything else works.
How did you fix it, fevangelou?
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...
@enmartinson Awesome, Thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think the only difference between them is Mautic uses index.php to init the application instead of app.php. Could be wrong, but that was my understanding when I did this originally.
mtracking.gif is a route defined in Symfony, and I think that as long as all the requests are pushed through index.php, then symfony should handle the proper response. But now that you mention it I don't remember ever testing mtracking.gif calls, I probably only tested using Mautic the app. So you might be right there.
Did you get Mautic's app to work on nginx? are you getting errors with mtracking?