MRatWork Forum by Mustafa Ramadhan

Sawo Project - Kloxo-MR Discussions => Kloxo-MR Tips and Tricks => Topic started by: naujasdizainas on 2014-03-01, 15:00:52

Title: [TIP] - how to create custom config NGINX, PHP-FPM for multiple CMS/Domain
Post by: naujasdizainas on 2014-03-01, 15:00:52
If all domain user one CMS, ok +/- how to config NGINX.
But if have like Magento, Joomla, Wordpress. For wordpress config I see file wp-proxy.conf and etc.
But for other CMS how make config like rewrite? Important: need config if run cleanup.sh or fix...sh configuration file leave unchanged. It's posible? 

Tips in -  http://forum.mratwork.com/kloxo-mr-tips-and-tricks/need-help-or-info-nginx-php-fpm-config-for-multiple-cms/msg30608/#msg30608 (http://forum.mratwork.com/kloxo-mr-tips-and-tricks/need-help-or-info-nginx-php-fpm-config-for-multiple-cms/msg30608/#msg30608)
Title: Re: Need help or info NGINX, PHP-FPM config for multiple CMS
Post by: MRatWork on 2014-03-01, 15:47:50
Basic 'custom rule', all files inside '/home/<webserver>/tpl' and '/home/<webserver>/conf/globals' will without overrite when update run cleanup if copy this files with 'custom.' prefix (let say copy domains.conf.tpl to custom.domains.conf.tpl) and Kloxo-MR will be process this custom file instead original files.
Title: Re: Need help or info NGINX, PHP-FPM config for multiple CMS
Post by: naujasdizainas on 2014-03-01, 18:10:56
Ok, thanks.
About custom i know. But question about config for multiple cms.
Situation:
Site A - run Magento CMS.
Site B - run Joomla CMS.
Server run Nginx + PHP-FPM. We make  'custom rule', all files inside '/home/<webserver>/tpl' and '/home/<webserver>/conf/globals'. Fine ...
But this rule is global for service but not for idividual site. If server run lighttpd, in admin console exist rewrite rule for lighttpd for individual site, but for Nginx not found.
I ask how to make rewrite if run Nginx for individual site. It's possible?
Title: Re: Need help or info NGINX, PHP-FPM config for multiple CMS
Post by: MRatWork on 2014-03-01, 18:47:42
Use your imagination.

For example:

Look at '/home/nginx/tpl/domains.conf.tpl' in portion:

Code: [Select]
if (file_exists("{$globalspath}/custom.php-fpm.conf")) {
    $phpfpmconf = 'custom.php-fpm.conf';
} else {
    $phpfpmconf = 'php-fpm.conf';
}

and I want modified to:
Code: [Select]
if (file_exists("{$globalspath}/custom.php-fpm.conf")) {
    $phpfpmconf = 'custom.php-fpm.conf';
} else {
    if ($domainname === 'tester1.com') {
        // need tester1.com.php-fpm.conf
        $phpfpmconf = $domain.com . 'php-fpm.conf';
    } else if ($domainname === 'tester2.com') {
        // need tester2.com.php-fpm.conf
        $phpfpmconf = $domain.com . 'php-fpm.conf';
    } else {
        $phpfpmconf = 'php-fpm.conf';
    }
}
Title: Re: Need help or info NGINX, PHP-FPM config for multiple CMS
Post by: naujasdizainas on 2014-03-01, 19:19:17
Thanks!
That is what I need ...

Little changes:
Code: [Select]
if (file_exists("{$globalspath}/custom.php-fpm.conf")) {
    $phpfpmconf = 'custom.php-fpm.conf';
} else {
    if (file_exists("{$globalspath}/$domainname.'php-fpm.conf")) {
    // add custom $domainname.php-fpm.conf
        $phpfpmconf = $domainname. 'php-fpm.conf';
    } else {
        $phpfpmconf = 'php-fpm.conf';
    }
}

Not tested yet, but thing must work