# Installing Mautic 5 using DDEV and nginx

**URL:** <https://forum.mautic.org/t/installing-mautic-5-using-ddev-and-nginx/32717>\
**Category:** Mautic 5 Install/Upgrade Support\
**Created:** [July 10, 2024, 6:11pm UTC](https://forum.mautic.org/t/installing-mautic-5-using-ddev-and-nginx/32717 "2024-07-10T18:11:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lolcode](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lolcode/32/12928_2.png) [@lolcode](https://forum.mautic.org/u/lolcode)\
**Post date:** [July 10, 2024, 6:11pm UTC](https://forum.mautic.org/t/installing-mautic-5-using-ddev-and-nginx/32717/1 "2024-07-10T18:11:17Z")

</div>

**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:

```auto
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:

```auto
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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [July 10, 2024, 6:22pm UTC](https://forum.mautic.org/t/installing-mautic-5-using-ddev-and-nginx/32717/2 "2024-07-10T18:22:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lolcode](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lolcode/32/12928_2.png) [@lolcode](https://forum.mautic.org/u/lolcode)\
**Post date:** [July 10, 2024, 6:27pm UTC](https://forum.mautic.org/t/installing-mautic-5-using-ddev-and-nginx/32717/3 "2024-07-10T18:27:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lolcode](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lolcode/32/12928_2.png) [@lolcode](https://forum.mautic.org/u/lolcode)\
**Post date:** [July 11, 2024, 2:08pm UTC](https://forum.mautic.org/t/installing-mautic-5-using-ddev-and-nginx/32717/4 "2024-07-11T14:08:20Z")

</div>

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:

> <https://github.com/mautic/mautic/issues/13268>
>
> \### Mautic Version
> 
> 5.0.x series
> 
> \### PHP version
> 
> 8
> 
> \### What browsers are you …seeing the problem on?
> 
> \_No response\_
> 
> \### What happened?
> 
> On Facebook it was pointed out that the link on our readme docs is broken:
> 
> https://github.com/mautic/mautic?tab=readme-ov-file#how-to-install-mautic
> 
> This is very out of date, and we should really use a single point of truth in the end-user docs at docs.mautic.org for how to install.
> 
> So for this issue we need to:
> 
> 1. Update the readme to remove that section
> 2. Point people to the end-user documentation
> 3. If you have time, perhaps consider a landing page on the end user docs for installing Mautic which explains the preferred method (composer) and then also links out to other methods.
> 
> \### How can we reproduce this issue?
> 
> !\[422615498\_4430904500467298\_7690102046203524160\_n\](https://github.com/mautic/mautic/assets/2930593/973abecd-88d8-413c-a245-4d2d87e7462a)
> 
> Check this link!
> 
> \### Relevant log output
> 
> \_No response\_
> 
> \### Code of Conduct
> 
> \- \[X\] I confirm that I have read and agree to follow this project's Code of Conduct
> 
> \<br /\>\<hr\>
> Care about this issue? Want to get it resolved sooner? If you are a \<a href='https://www.mautic.org/become-a-member-of-mautic'\>member of Mautic\</a\>, you can add some funds to the \<a href='https://opencollective.com/mautic/projects/bounties'\>Bounties Project\</a\> so that the person who completes this task can claim those funds once it is merged by a member of the core team! Read the docs \<a href='https://contribute.mautic.org/product-team/mautic-bounty-programme'\>here.\</a\>

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

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [July 11, 2024, 2:09pm UTC](https://forum.mautic.org/t/installing-mautic-5-using-ddev-and-nginx/32717/5 "2024-07-11T14:09:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lolcode](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lolcode/32/12928_2.png) [@lolcode](https://forum.mautic.org/u/lolcode)\
**Post date:** [July 11, 2024, 2:39pm UTC](https://forum.mautic.org/t/installing-mautic-5-using-ddev-and-nginx/32717/6 "2024-07-11T14:39:11Z")

</div>

Thanks, I replied here: [Slack](https://mautic.slack.com/archives/C02HV781U/p1720708642338019)
