Installing Mautic 5 using DDEV and nginx

Your software
My Mautic version is: 5.1.0
My PHP version is: 8.2
My Database type and version is: MariaDB 10.11

Your problem
My problem is:
I installed Mautic 5.1 using composer create-project.
This didn’t give me ddev setup but I copied one over from my Mautic 4 testing environment.

Multiple JS scripts are not found when loading the page. The dashboard just shows spinners.

This is my ddev config.yml:

name: mautic
type: php
docroot: "docroot"
php_version: "8.2"
webserver_type: nginx-fpm
router_http_port: "80"
router_https_port: "443"
xdebug_enabled: false
additional_hostnames:
  - m.m-site
  - m.m-site2
  - m.m-site3
additional_fqdns: []
mariadb_version: "10.11"
mysql_version: ""
provider: default
use_dns_when_possible: true
composer_version: "2"
webimage_extra_packages: [php8.2-imap]
hooks:
  post-start:
    # Fix line endings on Windows
    - exec: sed -i -e 's/\r$//' ./.ddev/mautic-setup.sh
    - exec: sed -i -e 's/\r$//' ./.git/hooks/*
    - exec: "yes | ./.ddev/mautic-setup.sh"

This is my nginx config:

server {
    listen 80 default_server;
    listen 443 ssl default_server;

    root /var/www/html/docroot;

    ssl_certificate /etc/ssl/certs/master.crt;
    ssl_certificate_key /etc/ssl/certs/master.key;

    include /etc/nginx/monitoring.conf;

    index index.php index.htm index.html;

    # Disable sendfile as per https://docs.vagrantup.com/v2/synced-folders/virtualbox.html
    sendfile off;
    error_log /dev/stdout info;
    access_log /var/log/nginx/access.log;

    # 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;
    }

    # pass the PHP scripts to FastCGI server listening on socket
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php-fpm.sock;
        fastcgi_buffers 16 16k;
        fastcgi_buffer_size 32k;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_intercept_errors off;
        # fastcgi_read_timeout should match max_execution_time in php.ini
        fastcgi_read_timeout 10m;
        fastcgi_param SERVER_NAME $host;
        fastcgi_param HTTPS $fcgi_https;
    }

    # Prevent clients from accessing hidden files (starting with a dot)
    # This is particularly important if you store .htpasswd files in the site hierarchy
    # Access to `/.well-known/` is allowed.
    # https://www.mnot.net/blog/2010/04/07/well-known
    # https://tools.ietf.org/html/rfc5785
    location ~* /\.(?!well-known\/) {
        deny all;
    }

    # Prevent clients from accessing to backup/config/source files
    location ~* (?:\.(?:bak|conf|dist|fla|in[ci]|log|psd|sh|sql|sw[op])|~)$ {
        deny all;
    }

    include /etc/nginx/common.d/*.conf;
    include /mnt/ddev_config/nginx/*.conf;
}

These errors are showing in the log:

https://mautic.ddev.site/node_modules/bootstrap/dist/js/bootstrap.js?vebdb5db2 404 (Not Found)Understand this error
dashboard:107 
        
        
       GET https://mautic.ddev.site/node_modules/js-cookie/src/js.cookie.js?vebdb5db2 net::ERR_ABORTED 404 (Not Found)Understand this error
dashboard:106 
        
        
       GET https://mautic.ddev.site/node_modules/jquery/dist/jquery.js?vebdb5db2 net::ERR_ABORTED 404 (Not Found)Understand this error
dashboard:109 
        
        
       GET https://mautic.ddev.site/node_modules/jquery-form/src/jquery.form.js?vebdb5db2 net::ERR_ABORTED 404 (Not Found)Understand this error
dashboard:118 
        
        
       GET https://mautic.ddev.site/node_modules/jquery.cookie/jquery.cookie.js?vebdb5db2 net::ERR_ABORTED 404 (Not Found)Understand this error
dashboard:111 
        
        
       GET https://mautic.ddev.site/node_modules/jquery.caret/dist/jquery.caret.js?vebdb5db2 net::ERR_ABORTED 404 (Not Found)Understand this error
dashboard:112 
        
        
       GET https://mautic.ddev.site/node_modules/codemirror/lib/codemirror.js?vebdb5db2 net::ERR_ABORTED 404 (Not Found)Understand this error
dashboard:113 
       

(And many others). It’s trying to load right from node_modules.

Steps I have tried to fix the problem:

I have tried re-running npm i to regenerate the assets.

Have you run bin/console m:a:g to regenerate the Mautic assets?

Thanks for your reply.
Yes. That is included as a post-install script in the composer.json.
I have also tried running it manually.

I managed to get past this. Most of the issues were my own struggles with Nginx and DDEV.

The only Mautic issue in the mix was a tiny documentation problem which would be worked on here:

I am not sure how to go about contributing to the issue.

If you’d like to make an edit to the readme, I can help you with that - feel free to ping me on Slack!

Thanks, I replied here: Slack