MRatWork Forum by Mustafa Ramadhan

Sawo Project - Kloxo-MR Discussions => Kloxo-MR Development => Topic started by: MRatWork on 2013-01-11, 12:40:26

Title: Kloxo-MR template-based config
Post by: MRatWork on 2013-01-11, 12:40:26
Taken from http://forum.lxcenter.org/index.php?t=m ... msg_102683 (http://forum.lxcenter.org/index.php?t=msg&th=19262&goto=102683&#msg_102683)

This is config directories structure:
Code: [Select]
/home
   |
   |____ apache
   |       |
   |       |____ conf
   |       |       |
   |       |       |____ defaults ==> content config for 'defaults' files
   |       |       |
   |       |       |____ domains ==> content config for 'domains' files
   |       |       |
   |       |       |____ globals ==> content config for 'globals' files (including files for 'defaults' and  'domains' files)
   |       |
   |       |____ etc
   |       |       |
   |       |       |____ conf ==> overwrite files for /etc/httpd/conf
   |       |       |
   |       |       |____ conf.d ==> overwrite files for /etc/httpd/conf.d
   |       |       |
   |       |       |____ init.d ==> overwrite files for /etc/rc.d/init.d (with remove extension .init)
   |       |
   |       |____ tpl ==> template files for 'defaults' and 'domains' files (processed by 'sh /script/fixweb')
   |
   |____ bind
   |       |
   |       |____ conf
   |       |       |
   |       |       |____ defaults ==> content config for 'defaults' files
   |       |       |
   |       |       |____ master ==> content config for 'master' files
   |       |       |
   |       |       |____ reverse ==> not implementing yet
   |       |       |
   |       |       |____ slave ==> not implementing yet
   |       |
   |       |____ etc
   |       |       |
   |       |       |____ conf ==> overwrite files for /etc/name.conf
   |       |
   |       |____ tpl ==> template files for 'domain', 'master list' and 'transfered' files (processed by 'sh /script/fixdns')
   |
   |____ djbdns
   |       |
   |       |____ axfrdns==> content config for 'tcp' and 'tcp.cdb' files for transfered
   |       |
   |       |____ conf
   |       |       |
   |       |       |____ defaults ==> content config for 'defaults' files
   |       |       |
   |       |       |____ master ==> content config for 'master' files
   |       |       |
   |       |       |____ reverse ==> not implementing yet
   |       |       |
   |       |       |____ slave ==> not implementing yet
   |       |
   |       |____ dnscache ==> not implementing yet
   |       |
   |       |____ etc
   |       |       |
   |       |       |____ conf ==> overwrite files for /etc/name.conf
   |       |
   |       |____ tinydns
   |       |       |
   |       |       |____ root ==> content config for 'data' and 'data.cdb' files for master
   |       |
   |       |____ tpl ==> template files for 'domain', 'master list' and 'transfered' files (processed by 'sh /script/fixdns')
   |
   |____ lighttpd
   |       |
   |       |____ conf
   |       |       |
   |       |       |____ defaults ==> content config for 'defaults' files
   |       |       |
   |       |       |____ domains ==> content config for 'domains' files
   |       |       |
   |       |       |____ globals ==> content config for 'globals' files (including files for 'defaults' and  'domains' files)
   |       |
   |       |____ etc
   |       |       |
   |       |       |____ conf ==> overwrite files for /etc/lighttpd
   |       |       |
   |       |       |____ conf.d ==> overwrite files for /etc/lighttpd/conf.d
   |       |       |
   |       |       |____ init.d ==> overwrite files for /etc/rc.d/init.d (with remove extension .init)
   |       |
   |       |____ tpl ==> template files for 'defaults' and 'domains' files (processed by 'sh /script/fixweb')
   |
   |____ nginx
   |       |
   |       |____ conf
   |       |       |
   |       |       |____ defaults ==> content config for 'defaults' files
   |       |       |
   |       |       |____ domains ==> content config for 'domains' files
   |       |       |
   |       |       |____ globals ==> content config for 'globals' files (including files for 'defaults' and  'domains' files)
   |       |
   |       |____ etc
   |       |       |
   |       |       |____ conf ==> overwrite files for /etc/nginx
   |       |       |
   |       |       |____ conf.d ==> overwrite files for /etc/nginx/conf.d
   |       |       |
   |       |       |____ init.d ==> overwrite files for /etc/rc.d/init.d (with remove extension .init)
   |       |
   |       |____ tpl ==> template files for 'defaults' and 'domains' files (processed by 'sh /script/fixweb')
   |
   |____ php-fpm
   |       |
   |       |____ etc ==> overwrite files for /etc
   |       |       |
   |       |       |____ init.d ==> overwrite file for /etc/rc.d/init.d (with remove extension .init)
   |       |
   |       |____ tpl ==> template files for /etc/php-fpm.conf (for php 5.2) and /etc/php-fpm.d/<pool>.conf (for php 5.3/5.4) (processed by 'sh /script/fixweb')
   |
   |____ phpini
   |       |
   |       |____ etc ==> overwrite files for /etc
   |       |       |
   |       |       |____ php.d ==> overwrite file for /etc/php.d
   |       |
   |       |____ tpl ==> template files for /etc/php.ini and /home/httpd/<domains>/php.ini files (processed by 'sh /script/fixphp')
Note:
- All files inside 'conf/globals/', 'etc/' and 'tpl/' can be customize with copy this file(s) to file(s) with 'custom.' prefix name and than modified this 'custom.' file
- Files inside 'tpl/' in format 'inline-php' (embedded php code)
- After modified 'custom.' file(s) need running:
Code: [Select]
# for apache/lighttpd/nginx/php-fpm
sh /script/fixweb

# for phpini
sh /script/fixphp

# for apache
service httpd restart

# for lighttpd
service lighttpd restart

# for nginx
service nginx restart

# for php-fpm/phpini for using nginx/lighttpd/php-fpm_event/_worker
service php-fpm restart
Title: Re: Kloxo-MR template-based config
Post by: WISTFUL on 2013-02-21, 22:44:02
After template files have been changed in future releases, Do we need to update our custom template files?

If there was a way that allowed us to just set our custom changes, It was very perfect!

For example we would enter the following values on dynamic.php.ini.tpl
Code: [Select]
$mr-generic = array(
"display_startup_errors" => "Off",
"error_log" => "custom_name"
);
$mr-php-53 = array(
"track_errors" => "On",
"expose_php" => "mr-clr"
);
And after run 'sh /script/fixphp' by user, compiler will apply these changes on php.ini files:

> In (### MR -- generic) section:
- Change 'display_startup_errors = On' to 'display_startup_errors = Off'
- Add 'error_log = custom_name'

> In (### MR -- specific for php 5.3+) section:
- Change 'track_errors = Off' to 'track_errors = On'
- Remove 'expose_php = On'
Title: Re: Kloxo-MR template-based config
Post by: MRatWork on 2013-02-21, 23:13:54
For content of php.ini, I just using 'default' configs.

If you want modified, use Kloxo-MR 'rule' where "All files inside 'conf/globals/', 'etc/' and 'tpl/' can be customize with copy this file(s) to file(s) with 'custom.' prefix name and than modified this 'custom.' file".

So, copy php.ini.tpl to custom.php.ini.tpl. Kloxo-MR will be use 'custom.' file when you run 'sh /script/fixphp'.
Title: Re: Kloxo-MR template-based config
Post by: WISTFUL on 2013-03-13, 23:23:24
How Can I filter some domains from custom.php.ini.tpl changes after 'sh /script/fixphp' or kloxo-mr update?
(related to enable/disable secondary php)
Title: Re: Kloxo-MR template-based config
Post by: WISTFUL on 2013-03-14, 10:35:02
Quote from: "WISTFUL"
How Can I filter some domains from custom.php.ini.tpl changes after 'sh /script/fixphp' or kloxo-mr update?
(related to enable/disable secondary php)
;) I found its solution:

1. Edit /home/phpini/tpl/custom.htaccess.tpl and replace '#AddHandler x-httpd-php52 .php' line with below codes:
Code: [Select]
<?php
$blacklist 
= array("user1""user2""user3");
if (
in_array($user$blacklist)) {
?>

#AddHandler x-httpd-php52 .php
<?php
} else {
?>

AddHandler x-httpd-php52 .php
<?php
}
?>
2. Replace user1, user2 and user3 with users that dont need secondary-php

3. Run below:
Code: [Select]
# sh /script/fixphp
# service php-fpm restart
Title: Re: Kloxo-MR template-based config
Post by: zeeshan030 on 2015-04-14, 13:25:30
Issue 2: i've some forwarding for a couple of account, so when i send an email to one account that has forwarding enabled, the email isn't found there. It gets forwarded to correct address, but is there a way to keep email on the account itself as well?
Title: Re: Kloxo-MR template-based config
Post by: MRatWork on 2015-04-14, 13:35:34
Issue 2: i've some forwarding for a couple of account, so when i send an email to one account that has forwarding enabled, the email isn't found there. It gets forwarded to correct address, but is there a way to keep email on the account itself as well?

Better create thread instead hijack old/different thread.