how to install mautic on nginx subfolder

Hello,



my other domain is running mautic without any issues , but I need to setup another domain recently moved to Nginx ( Amazon ec2)



I prefer to install on subfolder domain.com/em , I have following setup sites-available/default.conf

Code:
server { listen 80; server_name domain.com;

access_log /var/log/nginx/domain.com.access_log;
error_log /var/log/nginx/domain.com.error_log;

root /var/www/html;
index index.php index.htm index.html;

include /etc/nginx/global/wordpress.conf;
include /etc/nginx/global/restrictions.conf;
include /etc/nginx/global/mautic.conf;
}


& mautic.conf
Code:
location /em/ { # 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; root /var/www/html/em; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules }

Default vhost directives configuration, use only one config.

#include /etc/nginx/conf.vhost/site_default.conf;

## MAUTIC CUSTOM DIRECTIVE SETTINGS ##

# redirect index.php to root
rewrite ^/index.php/(.*) /$1  permanent;

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

# Deny everything else in /app folder except Assets folder in bundles
location ~ /app/bundles/.*/Assets/ {
    allow all;
    access_log off;
}
location ~ /app/ { deny all; }

## Need modification, causing error 404
# 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;
}

# 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 grunt, composer files
location ~* (Gruntfile|package|composer).(js|json)$ {
    deny all;
    access_log off;
    log_not_found off;
}

## END OF MAUTIC SETTINGS ##


# Pass all .php files onto a php-fpm/php-fcgi server.
location ~ /em/.+.php$ {
        # Zero-day exploit defense.
        # http://forum.nginx.org/read.php?2,88845,page=3
        # Won't work properly (404 error) if the file is not stored on this server, which is entirely possible with php-fpm/php-fcgi.
        # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on another machine.  And then cross your fingers that you won't get hacked.
        try_files $uri =404;

        fastcgi_split_path_info ^(.+.php)(/.+)$;
        #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini

        include fastcgi_params;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        #fastcgi_intercept_errors on;
        fastcgi_pass 127.0.0.1:9000;
}

## Uncomment to enable error page directives configuration.
#include /etc/nginx/conf.vhost/errorpage.conf;

my wordpress site works perfectly with fastcgi_pass 127.0.0.1:9000; on mautic it says "The site is currently offline due to encountering an error”

I have not crossed installation process but I can use aws rds as database right?

any help would be greatly appreciated

Hello,

my other domain is running mautic without any issues , but I need to setup another domain recently moved to Nginx ( Amazon ec2)

I prefer to install on subfolder domain.com/em , I have following setup sites-available/default.conf

[code] server {
listen 80;
server_name domain.com;

access_log /var/log/nginx/domain.com.access_log;
error_log /var/log/nginx/domain.com.error_log;

root /var/www/html;
index index.php index.htm index.html;

include /etc/nginx/global/wordpress.conf;
include /etc/nginx/global/restrictions.conf;
include /etc/nginx/global/mautic.conf;
}[/code]

& mautic.conf [code]
location /em/ {
# 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;
root /var/www/html/em;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}

Default vhost directives configuration, use only one config.

#include /etc/nginx/conf.vhost/site_default.conf;

## MAUTIC CUSTOM DIRECTIVE SETTINGS ##

# redirect index.php to root
rewrite ^/index.php/(.*) /$1  permanent;

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

# Deny everything else in /app folder except Assets folder in bundles
location ~ /app/bundles/.*/Assets/ {
    allow all;
    access_log off;
}
location ~ /app/ { deny all; }

## Need modification, causing error 404
# 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;
}

# 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 grunt, composer files
location ~* (Gruntfile|package|composer).(js|json)$ {
    deny all;
    access_log off;
    log_not_found off;
}

## END OF MAUTIC SETTINGS ##


# Pass all .php files onto a php-fpm/php-fcgi server.
location ~ /em/.+.php$ {
        # Zero-day exploit defense.
        # http://forum.nginx.org/read.php?2,88845,page=3
        # Won't work properly (404 error) if the file is not stored on this server, which is entirely possible with php-fpm/php-fcgi.
        # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on another machine.  And then cross your fingers that you won't get hacked.
        try_files $uri =404;

        fastcgi_split_path_info ^(.+.php)(/.+)$;
        #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini

        include fastcgi_params;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        #fastcgi_intercept_errors on;
        fastcgi_pass 127.0.0.1:9000;
}

## Uncomment to enable error page directives configuration.
#include /etc/nginx/conf.vhost/errorpage.conf;

[/code]

my wordpress site works perfectly with fastcgi_pass 127.0.0.1:9000; on mautic it says "The site is currently offline due to encountering an error”

I have not crossed installation process but I can use aws rds as database right?

any help would be greatly appreciated

bump! I can pay if need be , please reach me out , thanks

please close this , I am trying mautic.com and if need be would be switching to pro , have an issue there too guess its better to start new topic?