How does mautic-form.js work in nginx? Please share your nginx configuration wordpress + subfolder with mautic

Your software
My Mautic version is: 2.16.2
My PHP version is: 7.2.30

Your problem
My problem is: I am using Mautic for test purpose based on my environment Nginx, MariaDB and Letsencrypt and HSTS options from WordOps( like EasyEngine V3, simple Nginx configuration command) in the subfolder environment. For the first time, I have mtc.js 404 error, but I solve when I install Mautic in the subfolder. My Nginx knowledge is limited, so I am keep searching whenever I meet the error.

When I insert the form using Mautic wordpress plugin to my existing Wordpress site in the same VPS, I found the following error. I can collect e-mail successfully, but when a test user(me) input e-mail, website doesn’t show any message.

I guess it is not Mautic problem, but I don’t know how Mautic work, so I need some comments or opinion. What should I consider to solve this problem?

These errors are showing in the log:

[Error] Failed to load resource: the server responded with a status of 404 () (mautic-form.js, line 0)
[Error] Refused to execute as script because “X-Content-Type: nosniff” was given and its Content-Type is not a script MIME type.

I am confusing Mautic, Nginx configuraiton, WordOps basic configuration which one make problem or combination of these programs. I am keep changing the configuration, but anything couldn’t help. When I couldn’t use mautic properly in this time, I have to consider other solution. Sorry.

Steps I have tried to fix the problem:

Here is my some setting for using Mautic for subfolder.

server {


access_log /var/log/nginx/ rt_cache;
error_log /var/log/nginx/;

root /var/www/;

index index.php index.html index.htm;

include common/php72.conf;

include common/wpcommon-php72.conf;
include common/locations-wo.conf;
include /var/www/*.conf;

##Mautic configuration Start

location ^~ /mautic {
alias /var/www/;
try_files $uri $uri/ @mautic;

location ~ \.php {
    fastcgi_pass php72;
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    include /etc/nginx/fastcgi_params;


location @mautic {
rewrite /mautic/(.*)$ /mautic/index.php?/$1 last;

##Mautic Configuraiton End


Here is my /etc/nginx/common/php72.conf

Original WordOps configuration Start

location / {
try_files $uri $uri/ /index.php$is_args$args;
location ~ .php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php72;

Original WordOps configuration End

I add this configuration for mautic-form.js but didn’t work

location ~ /mautic/index.php/media/js/mautic-form.js {
more_set_headers ‘Access-Control-Allow-Origin : *’;
default_type “application/javascript”;
try_files $uri /index.php?$args @phpstream;

location @phpstream {
include fastcgi_params;
fastcgi_pass php72;

Does this article still exist?


Hey divs …

The article is unavailable at the moment … I’m unsure if it will be coming back, to be honest …

Hello Friend,

Thanks for the answer.