Hello WordOps developers and users
I am testing Mautic for e-mail marketing. I searched all the topic related with Mautic or js 404 errors, however I couldn't well understand Nginx and WordOps configuration, so please let me know some clue or share your experience for Mautic Test.
I install Wordpress and Mautic for subdirectory, and I used Mautic Wordpress plugin and insert form to collect e-mail.
However I got the following error,
[Error] Failed to load resource: the server responded with a status of 404 () (mautic-form.js, line 0)
[Error] Refused to execute https://xxx.com/mautic/index.php/media/js/mautic-form.js as script because “X-Content-Type: nosniff” was given and its Content-Type is not a script MIME type.
So I searched all related topics, so I tried like this. Maybe my understanding is very limited.
Here is my some setting for using Mautic for subfolder.
server {
server_name xxx.com www.xxx.com;
access_log /var/log/nginx/xxx.com.access.log rt_cache;
error_log /var/log/nginx/xxx.com.error.log;
root /var/www/xxx.com/htdocs;
index index.php index.html index.htm;
include common/php72.conf;
include common/wpcommon-php72.conf;
include common/locations-wo.conf;
include /var/www/xxx.com/conf/nginx/*.conf;
##Mautic configuration Start
location ^~ /mautic {
alias /var/www/xxx.com/mautic;
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;
}