Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 Nginx Error after Mautic Installation Email Configuration Screen #4

Open
P4ul2000 opened this issue May 30, 2021 · 23 comments
Open

Comments

@P4ul2000
Copy link

Hi, I have installed with Yunohost V 4.2.4 and assigned a domain.

We first had problems with the mysql user permission, but once passed that screen I got to this screen.

We used mysql root user and password.

Screenshot 2021-05-30 at 20 14 16

After I filled in gmail credentials this screen was displayed.

Screenshot 2021-05-30 at 20 15 54

Please could you suggest a fix.

Thank you!

@ericgaspar
Copy link
Member

Sorry I don't have a fix. The app is still in progress and doesn't work yet.

@JamesClarke7283
Copy link

Sorry I don't have a fix. The app is still in progress and doesn't work yet.

Still does not work.

What is the reason behind this issue?
what is missing?

@Beeblebrox-BSD
Copy link

Can confirm same issue on Stable & Testing (Bullseye)
App should not be marked as "Decent Quality"

@ericgaspar
Copy link
Member

ericgaspar commented Mar 14, 2022

I have pushed a patch. Could you test from testing branch?

Edit: Damn I can't make it work anymore. :/ It worked with localhost and port 25

@Beeblebrox-BSD
Copy link

My apologies, I seem to have omitted some important information in my post.

  1. I don't se a 'PHP Mail' option on my setup screen.
  2. When I move forward at this step I don't get 404. I get redirected back to the YNH User Portal. If I click on the Mautic icon/box, the page flashes/reloads and I'm still at the user portal. Server error logs show nothing.
  3. It seems to me that any Email Configuration that Mautic does not like causes the webapp to crash permanently. This does not make much sense, as users should normally be able to modify the email server configuration once inside the Mautic control panel. Perhaps the email server sanity checks at this step are too strict?
  4. I uninstalled, then reinstalled Mautic just to be sure. The error I describe above continues.

OTHER/FYI:

  • Once the webapp crashes, there's no "reset" option, so the only solution seems to be a complete uninstall/reinstall cycle.
  • I cannot find the default password for the user mautic@localhost, so I'm forced to reset the pw through the mysql CLI each reinstall cycle.

Thank you.

@Beeblebrox-BSD
Copy link

Looks like you pushed another patch, and there seems to be some progress on my end:

  • Upgraded Mautic, instead of flashing and staying on the control panel, I now get the YNH 404 error message. I did not uninstall/reinstall Mautic for this.
  • Here's the error log snippet from Nginx:
    *35 FastCGI sent in stderr: "PHP message: ArgumentCountError: Too few arguments to function Mautic\LeadBundle\Services\ContactSegmentFilterDictionary::__construct(), 0 passed in /var/www/mautic/var/cache/prod/Container3x16yy5/appAppKernelProdContainer.php on line 5094 and exactly 1 expected - in file /var/www/mautic/app/bundles/LeadBundle/Services/ContactSegmentFilterDictionary.php - at line 38" while reading response header from upstream, client: 192.168.x.x, server: example.org, request: "GET /mautic/ HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm-mautic.sock:", host: "example.org", referrer: "https://example.org/yunohost/sso/"

@JamesClarke7283
Copy link

JamesClarke7283 commented Jul 20, 2022

+1 same issue, 404.
It's been a while, I think the Integration level 7 and the “Working” badge should be changed as it is quite misleading,

In my opinion it should be marked as broken, At least until this issue is resolved, to avoid confusion.

For users who want to host Mautic on their Yunohost machine, should try using docker, which is a good way to run non-native services in Yunohost as well. The domain name/SSL config can still be done in the UI.

We used this technique for the web-portal demo on my instance.

@ericgaspar
Copy link
Member

NGINX config doesn't redirect correctly...

We get redirected to https://domain.tld/s/login instead of https://domain.tld/index.php/s/login

@wayneoutthere
Copy link

wayneoutthere commented Dec 27, 2022

I have exactly the same issue here. after installing and trying everything under the sun (including on a subdomain instead of main domain) I get nothing except 404 error and Nginx error. I am quite desperate and was just about to showcase Yunohost with Mautic for a group of very interested people :( Any help appreciated! This person above is absolutely correct. Nginx is not redirecting correctly and that seems to be all. If I manually type in: mautic.domain.com/index.php/s/login it works as expected. Seems like a possibly simple fix? Maybe? :) However as soon as you actually log in, it goes back to broken with a 'file not found' error. So it definitely seems like NGINX is not writing the stuff correct but I'm way to inexperienced to be able to go further with it.

@wayneoutthere
Copy link

Quick note! I installed the test branch and it seems everything is working awesome. I will test for another week or so and if you don't hear back from me this should be rolled out as the new code for app download, not the broke one. Thanks again!

@P4ul2000
Copy link
Author

P4ul2000 commented Jan 3, 2023

We have the test branch working as well. Just needed to reset the db password and add the user privileges and then install completed as expected. Great!

@wayneoutthere
Copy link

wayneoutthere commented Jan 3, 2023

Good day, I have one additional 'thing' that seems broken though. In the email configurations of mautic, when I enter any email (Yunohost, Gmail, etc), it will not connect nor complete the test email. I am not sure if this is a bug in the software, if I didn't somehow complete the setup, or what, but it would be nice to know if anyone else has been able to successfully do an email connection in the configurations and successfully send an email with mautic. I tried to uninstall /re-install (this part is working perfectly btw), all the software itself appears to work but the email connection part (the most important) is not for me. Thanks much and happy to try anything to make it work :)... the comment above made me think maybe my permissions are somehow not correct...

@wayneoutthere
Copy link

wayneoutthere commented Jan 3, 2023

I have a further addition to this thread I wanted to add. After encountering the SMTP connection problem above, I quickly did some testing and I also discovered a white screen of death when I opened the email Builder of Mautic. Everything else seemed to be working fine until I opened that. This continues to make me think I have a permission problem indeed... Any recommendations? Is this the cause of something on my server or this current branch of Mautic? The sooner anyone can confirm this the better so thanks again!

@ericgaspar
Copy link
Member

Check and share logs please

@ericgaspar
Copy link
Member

Also, open a new issue as this is not related to the present one.

@P4ul2000
Copy link
Author

P4ul2000 commented Jan 3, 2023

Seeing the same white screen of death when using the email builder on my install.

@wayneoutthere
Copy link

I've opened the white screen of death bug here

@ilannjoaquim
Copy link

Hi guys, how do you reset the pw of the mautic user in mysql ? I have also the error in mail builder and i can't send email too.

@wayneoutthere
Copy link

Do you mean the user that goes with the database or a regular user?

@ilannjoaquim
Copy link

Yes the user 'mautic' that goes with the database

@wayneoutthere
Copy link

Yes the user 'mautic' that goes with the database
That's a bit out of scope of this bug thread, but I would suggest joining the yunohost matrix group (pretty great) as well as i would 'guess' (disclaimer - i don't know much) that it would be found in var/www/mautic/some_config_dir/config.php I had to uninstall Mautic now because of this bug so I can't directly check for you...

@UVLabs
Copy link

UVLabs commented Mar 23, 2023

Just gonna add this comment in case anyone on the interwebs stumbles across this issue like me (even though I didn't even know about YunoHost)

The issue is with nginx. The redirect doesn't work properly.

If you try to visit your domain with index.php inside in the url, then it would work, example: https://mautic.example.com/index.php/s/login

So you need to add the following to your nginx .conf file for the domain where you have mautic installed;

location / {
     # try to serve file directly, fallback to app.php
     try_files $uri /index.php$is_args$args;
   }

Restart your nginx after and that alone should fix the issue, but there are some more locations you can add to the conf file:

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

   # redirect some entire folders
     rewrite ^/(vendor|translations|build)/.* /index.php break;

   location ~ \.php$ {
     include snippets/fastcgi-php.conf;
     fastcgi_pass unix:/run/php/php7.4-fpm.sock;
     #Note: If you install Mautic on iRedMail server, you should use the TCP socket instead.
     #fascgi_pass 127.0.0.1:9999
   }

   location ~* ^/index.php {
     # try_files $uri =404;
     fastcgi_split_path_info ^(.+\.php)(/.+)$;
     # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini

     fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
     #Note: If you install Mautic on iRedMail server, you should use the TCP socket instead.
     #fascgi_pass 127.0.0.1:9999
     fastcgi_index index.php;
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
     include fastcgi_params;

     fastcgi_buffer_size 128k;
     fastcgi_buffers 256 16k;
     fastcgi_busy_buffers_size 256k;
     fastcgi_temp_file_write_size 256k;
   }

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

     # Allow access to certbot directory in order to obtain TLS certificate
     location ~ /.well-known/acme-challenge {
        allow all;
     }
    # 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;
    }

    # Deny access to any files with a .php extension in the uploads directory
        location ~* /(?:uploads|files)/.*\.php$ {
                deny all;
    }

     # A long browser cache lifetime can speed up repeat visits to your page
  location ~* \.(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$ {
       access_log        off;
       log_not_found     off;
       expires           360d;
  }

This article pointed me in the right direction: https://www.linuxbabe.com/ubuntu/install-mautic-self-hosted-email-marketing-platform-ubuntu-18-04

Also make sure the www-data has ownership over the directory where you have mautic installed or else you might run into another error 500 issue when you do actually get access to your dashboard.

sudo chown -R www-data:www-data /yourmauticfolder/
sudo chmod -R 755 /yourmauticfolder/

@wayneoutthere
Copy link

wayneoutthere commented May 2, 2023

Thanks for your comments - sorry for delayed response. I actually don't know where I would make such a change in Yunohost environment. I tried in a 'sites-available' conf file and killed my entire Yunohost instance for a few minutes, lol. So probably I should figure out from someone smarter where I should try to make such a change for testing. Anyone? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants