Error Log /mtc.js failed. (No such file or directory)

Your software
My Mautic version is: 4.4.1
My PHP version is: 7.4.30
My Database type and version is: MySQL8

Your problem
My problem is: error appearing in log file

These errors are showing in the log: 2022/08/12 17:49:00 [error] 135785#135785: *1644 open() “/home/user/htdocs/mautic.mysite.com/mtc.js” failed (2: No such file or directory), client: 66.249.66.89, server: mautic.mysite.com, request: “GET /mtc.js HTTP/1.1”, host: “mautic.mysite.com”, referrer: “https://mysite.com/

Steps I have tried to fix the problem: not sure what the problem is. Looking for some help. Tried searching this forum.

Hi, do you see this file in the given folder?

Hi Joey,
No this file is missing in that directory?

Sorry, I’m wrong I think this is a generated file.
You won’t find it probably.
Did you allow rewrite in your Mautic web server or htaccess?

Hi Joey,
I did my install on an ubuntu 22.04 server using Cloudpanel which is supposed to work with Mautic and uses nginx as the webserver. As far as allowing rewrite in my web server or htaccess, I didn’t change anything, just did a standard install following Cloudpanel’s instructions. Looking at the htaccess file, the rewrite module is on. My Vhost install below.

server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
{{ssl_certificate_key}}
{{ssl_certificate}}
server_name mysite.com;
{{root}}

{{nginx_access_log}}
{{nginx_error_log}}

if ($scheme != “https”) {
rewrite ^ https://$host$uri permanent;
}

location ~ /.well-known {
auth_basic off;
allow all;
}

{{settings}}

location ~ ^/(config|tmp|core|lang) {
return 403;
}

location ~ /.ht {
return 403;
}

try_files $uri $uri/ /index.php?$args;
index index.php index.html;

location ~ .php$ {
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
try_files $uri =404;
fastcgi_read_timeout 3600;
fastcgi_send_timeout 3600;
fastcgi_param HTTPS $fastcgi_https;
fastcgi_pass 127.0.0.1:{{php_fpm_port}};
fastcgi_param PHP_VALUE “{{php_settings}}”;
}

location ~* ^.+.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|woff2|eot|mp4|ogg|ogv|webm|webp|zip|swf)$ {
add_header Access-Control-Allow-Origin “*”;
expires max;
access_log off;
}

if (-f $request_filename) {
break;
}
}

I’ve noticed in other mautic install blog posts that the vhost config file does something with the file extension mtc.js like in this post Install Mautic Self-Hosted Email Marketing on Ubuntu 18.04 Server. Is it possible the install script on cloudpanel is missing some code?

location ~ /(mtc.js|1.js|mtracking.gif|.*.gif|mtc) {
# default_type “application/javascript”;
try_files $uri /index.php$is_args$args;
}