Last active
May 28, 2023 16:24
-
-
Save manutheblacker/6558847b953394d25160040f1011db3e to your computer and use it in GitHub Desktop.
how to fix biggest issue with mautic 3, 4 and other versions
This file contains 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
Follow the instructions mentionned here : | |
https://github.com/mautic/mautic/issues/3942 | |
I've spent 4 days, 4 nights to fix this issue, please be careful with your mautic nginx configuration. | |
If you use apache, just chill and have a nice day. |
This file contains 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 { | |
# see: http://wiki.nginx.org/Pitfalls | |
# see: http://wiki.nginx.org/IfIsEvil | |
listen 80; | |
root /var/www/html;### change this to your app root ### | |
index index.html index.htm index.php; | |
error_page 404 /index.php; | |
# Make site accessible from http://set-ip-address.xip.io | |
server_name ### your external domain here ###; | |
access_log /var/log/nginx/access.log; | |
error_log /var/log/nginx/error.log error; | |
charset utf-8; | |
# redirect index.php to root | |
rewrite ^/index.php/(.*) /$1 permanent; | |
####################################### | |
## Start Mautic Specific config ##### | |
####################################### | |
# 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; | |
} | |
####################################### | |
## End Mautic Specific config ##### | |
####################################### | |
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | |
# | |
location ~ \.php$ { | |
# try_files $uri =403; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME /var/www/html/$fastcgi_script_name; | |
fastcgi_param PATH_INFO $fastcgi_script_name; | |
include fastcgi_params; | |
fastcgi_buffer_size 128k; | |
fastcgi_buffers 256 16k; | |
fastcgi_busy_buffers_size 256k; | |
fastcgi_temp_file_write_size 256k; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment