Mautic Community Forums

Error 404 with nginx: Impossible to install

MY CONF
My Mautic version is: 2.15
My PHP version is: 7.3

I tried to install mautic on my server with nginx. So I unzip mautic file in my folder and configure nginx like I configure another website I’ve on my server. But I didn’t finish the installation of mautic because I’ve a 404 error.
I understand that my problem is due to bad conf of nginx. But I don’t have goo knowledge about this techno. Someone can help me please.

my nginx conf:

server {
  listen 80;
  listen [::]:80;
  server_name MY_SERVER_NAME;
  root         /var/www/mautic/;
  index       index.php;

  charset utf-8;
  gzip on;
  gzip_types text/css application/javascript text/javascript application/x-javascript 	image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;

  location / {
    try_files $uri /index.php$is_args$args;
  }

  location ~ ^/(index_dev|config)\.php(/|$) {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    fastcgi_param DOCUMENT_ROOT $realpath_root;
  }

  location ~ ^/index\.php(/|$) {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    fastcgi_param DOCUMENT_ROOT $realpath_root;
    internal;
  }
    
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/ssl/certs/fullchain.pem;
    ssl_certificate_key /etc/ssl/certs/webiste.key;
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    if ($scheme != "https") {
        return 301 https://$host$request_uri;
    } # managed by Certbot

}

I found something that help me on this website: https://pepipost.com/tutorials/how-to-install-mautic-on-centos-7/
But I’ve still an error.
Now Mautic launch but display the error message:

The site is currently offline due to encountering an error. If the problem persists, please contact the system administrator.

I saw in the documentation that could be bad right on folder so I follow it but nothing change.

Of course any logs in nginx or mautic. So I can’t know where it comes

I become crazy !!!

I tried with version 3 of mantic but still this error…
I’ve tried in my local and I success to install it.

For permission I do this:

chown nginx:nginx mautic/
chmod 755 -R mautic/

I’ve miss something ?

There should be something in /var/log/nginx logs that might be useful. I not tried it on centos. Are you at least getting to where it ask u for database config etc?

For nginx I was able to use Ubuntu 18.04 LTS withe Mautic 3.1 successfully, after using the partial snippet below. Nice thing about Nginx is it was the system is 350MB ram.

For my main product site, I am using Bitnami Muatic 3.1 as it’s easier to manage for me. Even with this I had to comment out the X-Frame-Options in the Apache config as my email server is not the same as webhost.

**** To fix modify httpd.conf and comment out these lines

= 2.4.7 > # Header always setifempty X-Frame-Options SAMEORIGIN # Header always merge X-Frame-Options SAMEORIGIN RequestHeader unset Proxy

Mautic tracking fallback

location = /mtracking.gif {
expires off;
gzip off;
default_type “image/gif”;
add_header ‘Access-Control-Allow-Origin’ *;
try_files $uri /index.php?$args;
}

Mautic tracking code

location = /mtc.js {
expires off;
default_type “application/javascript”;
try_files $uri $uri/ /index.php$is_args$args;
}

Embedded forms

location = /form/generate.js {
expires off;
default_type “application/javascript”;
try_files $uri $uri/ /index.php$is_args$args;
}

location = /email/5eb1d62a797b6697395943.gif {
expires off;
gzip off;
default_type “image/gif”;
add_header ‘Access-Control-Allow-Origin’ *;
try_files $uri /index.php?$args;
}

############

for permalinks

location / {
try_files $uri $uri/ /index.php$is_args$args;
}

Here is a fail proof tutorial to installing Mautic.

Follow that step by step and I gaurentee it will work (use Mautic 2.16.3 IMO)

1 Like

Sorry But it doesn’t work for me. I’ve still the same error:

The site is currently offline due to encountering an error. If the problem persists, please contact the system administrator.

I’ll check the log and I saw only an error 500 on index.php. But I don’t understand why ?

Anyway, Once I’ve got another page that told me all point that I’ve to fix. And one is the permission on logs and cache file. So on other forum I’ve found solution but not working on me:
chmod 755 app/cache/* app/logs/* -R

Something else, On my server I can’t install php-imap. Can this be the source of all my problems?

Problem resolved.

I delete all my folder and Try again your solution @mikew and that’s work

Thanks for your help

2 Likes

great - happy to hear and happy to help

1 Like