2

What I want:

I want to install Mautic in a subfolder of my web root. I have a domain https://example.com and I want Mautic to be accessible from https://example.com/mautic.

What I have:

I have a server with

  • Ubuntu Server 18.04
  • Nginx 1.14.0
  • PHP 7.2
  • Let's Encrypt via Certbot
  • basic authentication (apache2-utils)

What I get:

I want to install Mautic in a subdirectory of a root (in my case web root is: /var/www/example.com/html).

However, when I wget latest Mautic release and unzip it to /var/www/example.com/html/mautic, and then I browse to https://example.com/mautic, it redirects to https://example.com/mautic/index.php/install and returns 404 in the web browser.


When I curl https://example.com/mautic I get

<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.14.0 (Ubuntu)</center>
</body>
</html>

When I curl https://example.com/mautic/ (Please Notice! Slash added) I get

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="refresh" content="0;url=https://example.com/mautic/index.php/installer" />

        <title>Redirecting to https://example.com/mautic/index.php/installer</title>
    </head>
    <body>
        Redirecting to <a href="https://example.com/mautic/index.php/installer">https://example.com/mautic/index.php/installer</a>.
    </body>
</html>

Result of ls -l /var/www/example.com/html/

-rwxr-xr-x 1 root     root      612 Apr 16 08:48 index.nginx-debian.html*
drwxr-xr-x 8 www-data www-data 4096 Apr 16 08:56 mautic/

This is my /etc/nginx/sites-enabled/example.com


server {
        root /var/www/example.com/html;
        index index.php index.html index.htm index.nginx-debian.html;
        server_name example.com;
        auth_basic "My custom death threat to all tresspassers.";
        auth_basic_user_file /etc/nginx/.htpasswd;

        location / {
                try_files $uri $uri/ =404;
        }

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        }

        location ~ /\.ht {
                deny all;
        }

        #tried to play with subfolder configuration right here

        location /mautic {
        root /var/www/example.com/html;
        try_files $uri $uri/ /index.php$is_args$args;
                location ~ \.php$ {
                        include snippets/fastcgi-php.conf;
                        fastcgi_param SCRIPT_FILENAME $request_filename;
                        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
                }
        }
        location @mautic {
                rewrite /mautic/(.*)$ /mautic/index.php?/$1 last;
        }


    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


}
server {
    if ($host = www.example.com) {
        rewrite (.*) https://example.com$request_uri;
    } # managed by Certbot


    if ($host = example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        listen 80;
        server_name example.com www.example.com;
    return 404; # managed by Certbot

}

And there is the phpinfo():

System  Linux MYNAME 4.15.0-47-generic #50-Ubuntu SMP Wed Mar 13 10:44:52 UTC 2019 x86_64
Build Date  Mar 22 2019 17:05:14
Server API  FPM/FastCGI
Virtual Directory Support   disabled
Configuration File (php.ini) Path   /etc/php/7.2/fpm
Loaded Configuration File   /etc/php/7.2/fpm/php.ini
Scan this dir for additional .ini files     /etc/php/7.2/fpm/conf.d
Additional .ini files parsed    /etc/php/7.2/fpm/conf.d/10-mysqlnd.ini, /etc/php/7.2/fpm/conf.d/10-opcache.ini, /etc/php/7.2/fpm/conf.d/10-pdo.ini, /etc/php/7.2/fpm/conf.d/15-xml.ini, /etc/php/7.2/fpm/conf.d/20-bz2.ini, /etc/php/7.2/fpm/conf.d/20-calendar.ini, /etc/php/7.2/fpm/conf.d/20-ctype.ini, /etc/php/7.2/fpm/conf.d/20-curl.ini, /etc/php/7.2/fpm/conf.d/20-dom.ini, /etc/php/7.2/fpm/conf.d/20-exif.ini, /etc/php/7.2/fpm/conf.d/20-fileinfo.ini, /etc/php/7.2/fpm/conf.d/20-ftp.ini, /etc/php/7.2/fpm/conf.d/20-gd.ini, /etc/php/7.2/fpm/conf.d/20-gettext.ini, /etc/php/7.2/fpm/conf.d/20-iconv.ini, /etc/php/7.2/fpm/conf.d/20-imap.ini, /etc/php/7.2/fpm/conf.d/20-intl.ini, /etc/php/7.2/fpm/conf.d/20-json.ini, /etc/php/7.2/fpm/conf.d/20-mbstring.ini, /etc/php/7.2/fpm/conf.d/20-mysqli.ini, /etc/php/7.2/fpm/conf.d/20-pdo_mysql.ini, /etc/php/7.2/fpm/conf.d/20-phar.ini, /etc/php/7.2/fpm/conf.d/20-posix.ini, /etc/php/7.2/fpm/conf.d/20-readline.ini, /etc/php/7.2/fpm/conf.d/20-shmop.ini, /etc/php/7.2/fpm/conf.d/20-simplexml.ini, /etc/php/7.2/fpm/conf.d/20-sockets.ini, /etc/php/7.2/fpm/conf.d/20-sysvmsg.ini, /etc/php/7.2/fpm/conf.d/20-sysvsem.ini, /etc/php/7.2/fpm/conf.d/20-sysvshm.ini, /etc/php/7.2/fpm/conf.d/20-tokenizer.ini, /etc/php/7.2/fpm/conf.d/20-wddx.ini, /etc/php/7.2/fpm/conf.d/20-xmlreader.ini, /etc/php/7.2/fpm/conf.d/20-xmlwriter.ini, /etc/php/7.2/fpm/conf.d/20-xsl.ini, /etc/php/7.2/fpm/conf.d/20-zip.ini
PHP API     20170718
PHP Extension   20170718
Zend Extension  320170718
Zend Extension Build    API320170718,NTS
PHP Extension Build     API20170718,NTS
Debug Build     no
Thread Safety   disabled
Zend Signal Handling    enabled
Zend Memory Manager     enabled
Zend Multibyte Support  provided by mbstring
IPv6 Support    enabled
DTrace Support  available, disabled
Registered PHP Streams  https, ftps, compress.zlib, php, file, glob, data, http, ftp, compress.bzip2, phar, zip
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, tls, tlsv1.0, tlsv1.1, tlsv1.2
Registered Stream Filters   zlib.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, mcrypt.*, mdecrypt.*, bzip2.*, convert.iconv.* 

I have no clue what am I doing wrong. How to get the Mautic installer to work in a subfolder? Thanks!

UPDATE 1

Nginx error.log

2019/04/16 14:18:10 [notice] 17193#17193: signal process started
2019/04/16 14:18:29 [notice] 17225#17225: signal process started
2019/04/16 15:46:08 [notice] 18855#18855: signal process started
2019/04/16 15:47:20 [notice] 18901#18901: signal process started
2019/04/16 15:52:37 [crit] 18902#18902: *30 SSL_do_handshake() failed (SSL: error:1417D18C:SSL routines:tls_process_client_hello:version too low) while SSL handshaking, client: 184.105.247.194, server: 0.0.0.0:443

and access.log

94.75.108.40 - user [16/Apr/2019:14:18:36 +0200] "GET /mautic/index.php/installer HTTP/1.1" 404 152 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
94.75.108.40 - user [16/Apr/2019:14:18:36 +0200] "GET /mautic/index.php/installer HTTP/1.1" 404 152 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
94.75.108.40 - user [16/Apr/2019:14:18:36 +0200] "GET /mautic/index.php/installer HTTP/1.1" 404 152 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
94.75.108.40 - user [16/Apr/2019:14:18:36 +0200] "GET /mautic/index.php/installer HTTP/1.1" 404 152 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
94.75.108.40 - user [16/Apr/2019:14:18:36 +0200] "GET /mautic/index.php/installer HTTP/1.1" 404 152 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
my.server.ip.address - user [16/Apr/2019:14:19:26 +0200] "GET /mautic HTTP/1.1" 301 194 "-" "curl/7.58.0"
my.server.ip.address - user [16/Apr/2019:14:19:47 +0200] "GET / HTTP/1.1" 200 612 "-" "curl/7.58.0"
94.75.108.40 - user [16/Apr/2019:14:20:55 +0200] "GET /mautic/index.php/installer HTTP/1.1" 404 152 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
94.75.108.40 - user [16/Apr/2019:14:20:55 +0200] "GET /favicon.ico HTTP/1.1" 404 152 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
171.13.14.46 - - [16/Apr/2019:14:38:22 +0200] "CONNECT 133.130.126.119:43 HTTP/1.1" 400 182 "-" "-"
94.75.108.40 - user [16/Apr/2019:14:59:50 +0200] "GET /mautic/ HTTP/1.1" 302 424 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
94.75.108.40 - user [16/Apr/2019:14:59:50 +0200] "GET /mautic/index.php/installer HTTP/1.1" 404 152 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
94.75.108.40 - user [16/Apr/2019:14:59:50 +0200] "GET /favicon.ico HTTP/1.1" 404 152 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
my.server.ip.address - user [16/Apr/2019:15:00:13 +0200] "GET /mautic HTTP/1.1" 301 194 "-" "curl/7.58.0"
my.server.ip.address - user [16/Apr/2019:15:00:22 +0200] "GET /mautic/ HTTP/1.1" 302 424 "-" "curl/7.58.0"
my.server.ip.address - user [16/Apr/2019:15:00:33 +0200] "GET /mautic/index.php HTTP/1.1" 302 464 "-" "curl/7.58.0"
94.75.108.40 - user [16/Apr/2019:15:26:58 +0200] "GET /info.php HTTP/1.1" 200 26052 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
94.75.108.40 - user [16/Apr/2019:15:26:58 +0200] "GET /favicon.ico HTTP/1.1" 404 152 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
94.75.108.40 - user [16/Apr/2019:15:46:12 +0200] "GET / HTTP/1.1" 404 152 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
94.75.108.40 - user [16/Apr/2019:15:46:12 +0200] "GET /favicon.ico HTTP/1.1" 404 152 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
94.75.108.40 - user [16/Apr/2019:15:46:16 +0200] "GET /mautic/ HTTP/1.1" 302 424 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
94.75.108.40 - user [16/Apr/2019:15:46:16 +0200] "GET /mautic/index.php/installer HTTP/1.1" 404 152 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
94.75.108.40 - user [16/Apr/2019:15:46:21 +0200] "GET /mautic/index.php/installer HTTP/1.1" 404 152 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
94.75.108.40 - user [16/Apr/2019:15:46:25 +0200] "GET / HTTP/1.1" 404 152 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
94.75.108.40 - user [16/Apr/2019:15:47:23 +0200] "GET / HTTP/1.1" 200 396 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
94.75.108.40 - - [16/Apr/2019:15:48:29 +0200] "GET /mautic/ HTTP/1.1" 401 204 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
94.75.108.40 - - [16/Apr/2019:15:48:29 +0200] "GET /favicon.ico HTTP/1.1" 401 204 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"

UPDATE 2

Just for test I've tried bunch of other self-hosted goodies (ie. InfiniteWP) and they all work all right.

  • What's in the nginx error log? – Michael Hampton Apr 16 at 15:14
  • Hey @MichaelHampton thanks for the question. I've updated the post with logs readouts. – Lukasz Pojezierski Apr 16 at 15:43
  • For example, I have similar situation with Vtiger. Exactly the same output. – Lukasz Pojezierski Apr 17 at 11:08
0

What a joke. In Nginx error.log I've finally found an answer:

I did not chmod 777 the folder, which was required in order to process with the installation. :D What a fail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.