Wednesday, March 3, 2010
recursion restrictions for named.conf
I'm getting this warning from check server security option in csf :
You have a local DNS server running but do not have any recursion restrictions set in /etc/named.conf. This is a security and performance risk and you should look at restricting recursive lookups to the local IP addresses only
--
solution:
Make backup copy of named.conf
#cp /etc/named.conf /etc/named.conf-backup
#vi /etc/named.conf
The top of your named.conf should look something like:
-------------------------------------------------------------------
include "/etc/namedb/rndc.key";
controls {
inet 127.0.0.1 allow { localhost; } keys { "rndc-key"; };
};
acl "trusted" {
127.0.0.1;
};
options {
pid-file "/var/run/named/named.pid";
directory "/etc/namedb";
dump-file "/var/dump/named_dump.db";
statistics-file "/var/stats/named.stats";
version "BIND";
allow-recursion { trusted; };
allow-notify { trusted; };
allow-transfer { trusted; };
forwarders { 127.0.0.1; };
};
------------------------------
If you don't have the lines in bold, add them to your named.conf (make a backup first!) and restart BIND. You can also add additional IP addresses if you have other servers in the DNS cluster.
Restart bind.
Mysql optimization
[mysqld]
set-variable = max_connections=500
safe-show-database
local-infile=0
===========================================
[mysqld]
max_connections = 500
key_buffer = 32M
myisam_sort_buffer_size = 32M
join_buffer_size = 1M
read_buffer_size = 1M
sort_buffer_size = 2M
table_cache = 4000
thread_cache_size = 286
interactive_timeout = 25
wait_timeout = 7000
connect_timeout = 10
max_allowed_packet = 16M
max_connect_errors = 10
query_cache_limit = 4M
query_cache_size = 12M
query_cache_type = 1
tmp_table_size = 16M
skip-innodb
[mysqldump]
quick
max_allowed_packet = 16M
[myisamchk]
key_buffer = 64M
sort_buffer = 64M
read_buffer = 16M
write_buffer = 16M
[mysqlhotcopy]
interactive-timeout
Script Configuration Files
Location of Script Configuration Files
Config file locations.
| 4Images Gallery | /config.php |
| B2 Evolution | /conf/_basic_config.php |
| Boonex Dolphin | /inc/header.inc.php |
| Coppermine Photo Gallery | /include/config.inc.php |
| Cube Cart | /includes/global.inc.php |
| dotProject | /includes/config.php |
| Drupal | /sites/default/settings.php |
| FAQMasterFlex | /faq_config.php |
| Gallery | /config.php |
| Geeklog | /db-config.php /siteconfig.php /lib-common.php |
| Joomla | /configuration.php |
| Mambo | /configuration.php |
| Moodle | /config.php |
| Noahs Classifieds | /app/config.php |
| Nucleus | /config.php |
| osCommerce | /includes/configure.php /admin/includes/configure.php |
| PHP-Nuke | /config.php |
| phpBB | /config.php |
| phpFormGenerator | (only if you have saved form input to a database) /forms/admin/config.inc.php |
| PHPlist | /config/config.php |
| phpWCMS | /include/inc_conf/conf.inc.php |
| phpWebSite | /conf/config.php |
| PhpWiki | /admin.php /lib/config.php |
| Post-Nuke | /config.php |
| Siteframe | /config.php |
| SMF | /Settings.php |
| Soholaunch | /sohoadmin/config/isp.conf.php |
| TYPO3 | /typo3conf/localconf.php |
| vBulletin | /includes/config.php |
| WebCalendar | /includes/settings.php |
| WordPress | /wp-config.php |
| Xoops | /mainfile.php |
| Zen Cart | /includes/configure.php /admin/includes/configure.php |
These paths are relative to the root of the script, not the account nor domain. So if it's a vBulletin forum, under /home/username/www/forum/, the configuration file would be in /home/username/www/forum/includes/config.php
Tuesday, March 2, 2010
Alternative PHP Cache [APC]
APC is a free, open, and robust framework for caching and optimizing PHP intermediate code. Here are the most simple steps :
# Login to the server as root
# Download APC
wget http://pecl.php.net/package/APC
eg : wget http://pecl.php.net/get/APC-3.0.15.tgz
# Extract it and move into the directory
tar -xzf APC-3.0.15.tgz
cd APC*
# Locate where php is
which php
This should return something like: /usr/local/bin/php Remember the location of php.
# Create configuration files
phpize
# Compile APC
./configure --enable-apc --enable-apc-mmap --with-apxs --with-php-config=/usr/local/bin/php-config
make
make install
# Install APC into php.ini
You will have to first locate php.ini using the following command
php -i | grep php.ini
This will usually return /usr/local/Zend/etc/php.ini on a server that has Zend optimizer installed. Now edit php.ini and add the APC extension.
vi /usr/local/Zend/etc/php.ini
Scroll down to the bottom and add the fallowing before the lines about the zend optimizer (They start with [Zend])
extension=”/apc_location/apc.so”
# Restart Apache
# Restart Apache
SOA parameters for a DNS server
1. Set the following parameters
1. Set the following parameters
Parameter Name | Description | Notes |
the mailbox of the person responsible for this DNS server. |
| |
TTL | "time-to-live": the time, in seconds, this DNS server caches (keeps) a piece of information received from your server before it asks your server again. |
The solution is as follows:
It is standard practice to reduce the TTL transmitted with information that is scheduled to change in order to make that change visible rapidly throughout the Internet; once the change has happened, the TTL is increased again. |
Refresh | the time interval, in seconds, before which the zones need to be updated. |
|
Retry | the time interval, in seconds, after which the next attemp of refresh should be taken, after a refresh failure. |
|
Expire | the upper limit, in seconds, on the time interval that can elapse before the zones are no longer authoritative |
|
Minimum TTL | the minimum number of seconds to be used for TTL value in RRs. | By default, 86400 (1 day) is set, which is a good value. |
Virtuozzo Configuration Files
Matrix of Virtuozzo Configuration Files
There are a number of files responsible for the Virtuozzo system configuration. Most of the files are located in the /etc directory on the Hardware Node. However, some configuration files are stored in the /etc directory inside the Service Container, on the Backup Node, inside a Container, or on a dedicated server. In case a configuration file is located in a place other than the Hardware Node, we point clearly the exact position (the Service Container, etc.) where it can be found.
A list of configuration files is presented in the table below:
| The Virtuozzo global configuration file. This file keeps system-wide settings, affecting Container and Virtuozzo template default location, global network settings and so on. |
| The private configuration file owned by a Container numbered |
| Sample files, containing a number of default Container configurations, which may be used as a reference for Container creation. The following samples are shipped with Virtuozzo: |
| The configuration files used to determine what scripts are to be run on performing some operations in the Container context (e.g. on adding a new IP address to the Container). These scripts are different from Virtuozzo action scripts and depend on the Linux version the given Container is running. |
| The configuration file used for the Service Container creation by |
| Parallels Agent configuration files. |
| The definition of network classes, used by traffic shaping and bandwidth management in Virtuozzo. |
| This file specifies the default connection parameters for the |
| This configuration file specifies the default connection parameters for the |
| The configuration file for the |
| The configuration file used to define the parameters for establishing a private secure channel to the Parallels support team server. |
| The configuration file used to define the parameters for sending your problem report to the Parallels support team. |
| Kernel parameters. Virtuozzo adjusts a number of kernel |
| These files define the offline management modes for controlling Containers by Container administrators. |
| This configuration file defines the parameters used by the |
| The file lists the warning and/or error levels for a number of resource control parameters. If a parameter hits the warning or error value, the |
| This configuration file is located on the Monitor Node and used by the |
| The global configuration file residing on the Backup Node and determining the global Container backup settings. |
| The Red Hat Network (RHN) Proxy Server configuration file used by the |
| This configuration file is used by the |
| This configuration file is used by the |
Install XCache
To install follow the steps
1. Download and extract the source for XCache .
# cd /usr/local/src/
# wget http://xcache.lighttpd.net/pub/Releases/1.2.2/xcache-1.2.2.tar.gz
# tar -xzvf xcache-1.2.2.tar.gz
2. Build, configure and install the XCache module.
# cd xcache-1.2.2
# phpize
# ./configure --enable-xcache
# make && make install
You can see a message like this . Note the extension directory.
=============
Build complete.
Don’t forget to run ‘make test’.
Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20060613/
==============
3. Now configure the php.ini file ( To find .ini file, use the command `php -i | grep php.ini` )
# cat xcache.ini >> /usr/local/lib/php.ini
Replace the following line in php.ini with correct path ,which describes the Installed shared extensions that we noted above.
zend_extension = /usr/local/lib/php/extensions/non-debug-non-zts-xxx/xcache.so
It will become like this,
zend_extension = /usr/local/lib/php/extensions/no-debug-non-zts-20060613/xcache.so
4. Restart apache and confirm the Xcache installation.
# /etc/init.d/httpd restart
# php -v
it will show you as
-----------
php -v
PHP 5.2.8 (cli) (built: Feb 16 2009 05:42:38)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
with XCache v1.2.2, Copyright (c) 2005-2007, by mOo
--------